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
Answer:
We use Excel to make charts and find the average right? Or else in mobile u can use Google sheets.
Explanation:
I will attach some pics
These are just examples
Try it!!
Hope this helps
Given➛
Write a Java program......
(In the question)
____________________________
Code:-
import java.util.*;
class Average
{
public static void main()
{
Scanner sc =new Scanner(System.in);
System.out.println("Name:-")
String name= sc.nextLine(),grade="";
System.out.println("\n Physics marks out of 100:-")
int p=sc.nextInt();
System.out.println("\n Chemistry marks out of 100:-")
int c=sc.nextInt();
System.out.println("\n Biology marks out of 100:-")
int b=sc.nextInt();
double Avr=(p+c+b)/3.0;
//if else condition began
if(Avr>=80)
grade="Distinction";
else if (Avr>=60&&Avr<80)
grade="First devision";
else if (Avr>=45&&Avr<60)
grade="Second devision";
else if (Avr>=40&&Avr<45)
grade="Pass";
else if (Avr<40)
grade="Promotion not granted";
//end of if else Condition
System.out.println("\f Name:-"+name);
System.out.println("\n Average marks:-"+Avr);
System.out.println("\n Grade:-"+grade);
}
}
_______________________________
INPUT:-
Name:-
Vyom singh
Physics marks out of 100:-
80
Chemistry marks out of 100:-
70
Biology marks out of 100:-
90
____________________________
OUTPUT:-
Name:-Vyom singh
Average marks:- 80
Grade:-Distinction