Question: Complete the Java application by writing the code segments that will complete this if-else-while-problem. Problem Solving Process is not necessary. You have 15 minutes. import

Complete the Java application by writing the code segments that will complete this if-else-while-problem. Problem Solving Process is not necessary. You have 15 minutes.

import java.util.Scanner; // class uses class Scanner

public class MyGrades1

{

public static void main(String[] args)

{

Scanner input = new Scanner( System.in );

System.out.print( "Enter grade 1-100: " );

studentGrade = input.nextInt();

while (studentGrade >= 0)

{

if (studentGrade >= 90)

{

System.out.println("A");

++countGrade;

}

else if (studentGrade >= 80)

{

System.out.println("B");

++countGrade;

}

else if (studentGrade >= 70)

{

System.out.println("C");

++countGrade;

}

else if (studentGrade >= 60)

{

System.out.println("D");

++countGrade;

}

else

{

System.out.println("F");

++countGrade;

}

}//end of while loop

System.out.printf("The average of these %d grades is: %5.2f ",

countGrade, avgGrade = totalGrade/countGrade);

}//end main

}// end class

SAMPLE OUTPUT:

Enter grade 1-100: 100

A

Enter grade 1-100: 75

C

Enter grade 1-100: 50

F

Enter grade 1-100: -1

The average of these 3 grades is: 75.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!