Computer Science, asked by Itzraisingstar, 8 months ago

In examination the grades are awarded to the students in science according to the average marks obtained in the examination :
Marks Grades

80% and above Distinction

60% or more but less than 80% First Division

45% or more but less than 60% Second Division

40% or more but less than 45% Pass

less then 40% Promotion not granted


Write a program to input name and marks in physics, chemistry and biology .Calculate the average marks. Display the name, average marks and the grade obtained.

Use scanner class

Any mod answer please no spams

Answers

Answered by Sauron
33

Answer:

Explanation:

import java.util.Scanner;

public class StudentMarksheet{

 int chemistry,physics,biology;

String StudentName="";

Scanner sc = new Scanner (System.in);

System.out.println("\n Please Enter Student Name :- ");

StudentName = sc.nextLine();

System.out.println("\n Please Enter Chemistry subject Marks :-");

chemistry = sc.nextInt();

 System.out.println("\n Please Enter physics subject Marks :-");

 physics = sc.nextInt();

 System.out.println("\n Please Enter Biology subject Marks :-");

 biology = sc.nextInt();

int totalmarks = chemistry+physics+biology;

 double percentage = totalmarks / 3;

string passingclass = "";

if(percentage > 85)

passingclass = "Distinction";

if(percentage <= 85 && percentage > 60)

passingclass = "First Division";

if(percentage <= 60 && percentage > 45)

passingclass = "Second Division";

if(percentage <= 45 && percentage > 40)

passingclass = "Pass";

if(percentage < 40)

passingclass = "Promotion Not Granted";

if(percentage > 40)

System.out.println("\n Congratulations Dear " +studentName+" you have scored " +percentage+ " Markes "+ " and passed with Grade "+passingclass) ;

if(percentage < 40)

System.out.println("\n Better Luck Dear " +studentName+" you have scored" +percentage +" Marks "+ " and passed with Grade  "+passingclass);

  }

}

   

Attachments:
Answered by vk8091624
7

Check the grade of the students based on marks. First of all we will take input a mark of subject from the candidate and according to following condition we will calculate the grade.

  1. If marks <50 then Grade is F
  2. if marks >=50 <60 then Grade is D
  3. if marks >=60 <70 then Grade is C
  4. if marks >=70 <80 then Grade is B
  5. if marks >=80 <90 then Grade is A
  6. if marks >=90 then Grade is A+

Program to Calculate Grade According to marks

In following program we have taken one variables i.e mark. We will take input from the user and using if else condition we will calculate grade. in the following program in first condition we will print wrong entry if the marks is either less than 0 or greater than 100.

#include<stdio.h>

void main()

{

int marks;

printf("Enter your marks ");

scanf("%d",&marks);

if(marks<0 || marks>100)

{

printf("Wrong Entry");

}

else if(marks<50)

{

printf("Grade F");

}

else if(marks>=50 && marks<60)

{

printf("Grade D");

}

else if(marks>=60 && marks<70)

{

printf("Grade C");

}

else if(marks>=70 && marks<80)

{

printf("Grade B");

}

else if(marks>=80 && marks<90)

{

printf("Grade A");

}

else

{

printf("Grade A+");

}

}

Hope it's help you sir

Be Happy Always..... :) ☺☺

Similar questions