Please Help must be in JAVA Letter Grade Your program should

Please Help, must be in JAVA

Letter Grade. Your program should ask the user to input a grade (integer from 1-100) and then output the letter grade. Scale: Greater than 90 is an \"A\"; Greater than 80 to 90 is a \"B\", Greater than 70 to 80 is a \"C\", Greater than 60 to 70 is a \"D\", and 60 or less is an \"F\". Letter Grade application needs to include: A while loop so one does not have to re-start the program with every new grade. Use any score less than 0 (zero) as the sentinel to stop the while loop. You need to use If and else statements, not just If statements. Input grade and letter grade should be output to screen with each number grade input. Finally, your application will calculate and output the average grade for students input. Program should still ask the user to input a grade (integer from 1-100) and then output the letter grade. Scale: Greater than 90 is an \"A\"; Greater than 80 to 90 is a \"B\", Greater than 70 to 80 is a \"C\", Greater than 60 to 70 is a \"D\", and 60 or less is an \"F\". Please include a screen capture with the write up.

Solution

GradeGradeLetterAverage.java

import java.util.Scanner;

public class GradeGradeLetterAverage {

   public static void main(String[] args) {

       //Declaring the constant
       final int SENTINEL = -1;
      
       //Declaring the variables
       int grade = 0, count = 0;
       double sum = 0, average;
       char gradeLetter = 0;

       // Scanner class object is used to read the inputs entered by the user
       Scanner sc = new Scanner(System.in);

       //This while loop continues to execute until the user enters -1 as input
       while (grade != SENTINEL) {

           //Getting the grade entered by the user
           System.out.print(\"Enter Grade :\");
           grade = sc.nextInt();
           if (grade == SENTINEL)
               continue;
           else {
              
               //based on the user entered grade ,grade letter will be captured
               if (grade > 90)
                   gradeLetter = \'A\';
               else if (grade > 80 && grade <= 90)
                   gradeLetter = \'B\';
               else if (grade > 70 && grade <= 80)
                   gradeLetter = \'C\';
               else if (grade > 60 && grade <= 70)
                   gradeLetter = \'D\';
               else if (grade <= 60)
                   gradeLetter = \'F\';

               //Displaying the grade letter
               System.out.println(\"Your Grade Letter :\" + gradeLetter);

               //Calculating the sum of grades
               sum += grade;

               //Counting the number of inputs
               count++;
              

           }

       }
      
       //Calculating the average
       average = sum / count;
      
       //Displaying the average grade
       System.out.println(\"Average grade is :\" + average);
   }

}

____________________

output:

Enter Grade :78
Your Grade Letter :C
Enter Grade :95
Your Grade Letter :A
Enter Grade :90
Your Grade Letter :B
Enter Grade :77
Your Grade Letter :C
Enter Grade :66
Your Grade Letter :D
Enter Grade :56
Your Grade Letter :F
Enter Grade :54
Your Grade Letter :F
Enter Grade :45
Your Grade Letter :F
Enter Grade :40
Your Grade Letter :F
Enter Grade :82
Your Grade Letter :B
Enter Grade :-1
Average grade is :68.3

_______ThankYou

Please Help, must be in JAVA Letter Grade. Your program should ask the user to input a grade (integer from 1-100) and then output the letter grade. Scale: Great
Please Help, must be in JAVA Letter Grade. Your program should ask the user to input a grade (integer from 1-100) and then output the letter grade. Scale: Great

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site