Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

import java.util.

Scanner;
public class Main {
public static void main(String[] args) {
Scanner m = new Scanner(System.in);
System.out.print("Enter Math grade:");
double math = m.nextDouble();
Scanner p = new Scanner(System.in);
System.out.print("Enter Physics grade:");
double physics = p.nextDouble();
Scanner c = new Scanner(System.in);
System.out.print("Enter Computer Science grade:");
double computer = c.nextDouble();
double average = (math + physics + computer) / 3;
System.out.print("The average of the grades is " + average);
if (90<= average){
System.out.print("the grade is A");
}
if ((80<=average)&&(average<=90)){
System.out.print("the grade is B");
}
if ((70<=average)&&(average<=80)){
System.out.print("the grade is C");
}
if ((60<=average)&&(average<=70)){
System.out.print("the grade is D");
}
if (average < 60) {
System.out.print("the grade is F");
}
}
}

You might also like