Question: Declare a String variable to store the user's name and a double to store their grade entered from the keyboard. Modify the main method to

  1. Declare a String variable to store the user's name and a double to store their grade entered from the keyboard. Modify the main method to have the program displays their name in the output.
  2. Your changes will only be made in the main method.
  3. The output would look like this:
    • Hello, please tell me your first name: Grace Grace, please enter your percentage: 62.3 Grace, a 62.3 is a D Declare a String variable to store the user's name and a

public class TestVoidMethod { public static void main(String[] args) { System.out.print("The grade is "); printGrade (78.5); System.out.print("The grade is "); printGrade (59.5); 9 10 11 public static void printGrade (double score) { if (score >= 90.0) { System.out.println('A'); 12 73 14 else if (score >= 80.0) { System.out.println('B'); 15 16 17 else if (score >= 70.0) { System.out.println('C'); 18 19 20 else if (score >= 60.0) { System.out.println('D'); 21 22 23 24 else { System.out.println('F'); } 25 26 27 } } The grade is C The grade is F

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!