Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I CAN'T FIGURE OUT WHY THE LETTER GRADE IS NOT DISPLAYING AT THE END OF THE CODE. any help would be greatly appreciated public class

I CAN'T FIGURE OUT WHY THE LETTER GRADE IS NOT DISPLAYING AT THE END OF THE CODE. any help would be greatly appreciated

public class assign1 {

public static void main(String[] args) { Scanner scan = new Scanner(System.in);

System.out.println("Please supply year of birth:"); int year = scan.nextInt();

System.out.println(" To see at what year you would be what age, please supply your age:"); int age = scan.nextInt();

int sum = year + age;

System.out.println(" When you are " + age + " , the year will be: " + sum);

Scanner in = new Scanner(System.in); System.out.print("enter first grade: "); double g1 = in.nextDouble(); System.out.print("enter second grade: "); double g2 = in.nextDouble(); System.out.print("enter third grade: "); double g3 = in.nextDouble(); System.out.print("enter fourth grade: "); double g4 = in.nextDouble(); System.out.print("enter fifth grade: "); double g5 = in.nextDouble(); double g = (g1+ g2+ g3+ g4+ g5)/5; System.out.printf("your average grade is: %.2f",g); if(g >= 90 && g<100) { System.out.println(" your Grade is A"); } else if(g >= 80 && g < 90) { System.out.println(" your Grade is B"); } else if(g >= 70 && g < 80) { System.out.println(" your Grade is C"); } else if(g >= 60 && g < 70) { System.out.println(" your Grade is D"); }else { System.out.println(" your Grade is F"); }

} }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions