public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter Score of TMA :"); double TMA = input.nextDouble(); System.out.println("Enter Score of MTA :"); double MTA = input.nextDouble(); System.out.println("Enter final exam score :"); double exam = input.nextDouble(); String grd=theGrads(TMA,MTA,exam); System.out.println("the grade is: " + grd); } public static String theGrads (double TMA,double MTA , double exam) { double total =TMA + MTA + exam; String grade = ""; if(total>=90) grade="A"; else if(total >=80 && total <90) grade="B"; else if(total >=70 && total <80) grade="C"; else if(total >=60 && total <70) grade="D"; else grade="F"; return grade; } }
read number_of_students for each student { read the 3 scores compute the letter grade print the results }
for ( int i = 0; ( i < number_of_students ); i++ )
read_scores ( ) compute_letter_grades ( ) print_letter_grade ( )
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)