subject

Write a program to read a list of exam grades given as int's in the range of 0 to 100. Your program will display the total number of grades and the number of grades in each letter-grade category as follows: A93 <= grade <= 100 A- 90 <= grade < 93 B+ 87 <= grade < 90 B 83 <= grade < 87 B- 80 <= grade < 83 C+ 77 <= grade < 80 C 73 <= grade < 77 C- 70 <= grade < 73 D 60 <= grade < 70 F 0 <= grade < 60 Use a negative number as a sentinel value to indicate the end of the input. (The negative value is used only to end the loop, do not use it in your calculations.) Each time you prompt the user to enter a grade you will print: Enter a grade:
For example, if the input is: 98 95 87 86 83 92 85 78 74 72 81 71 69 63 50 43 -1 The output would be:
Total number of grades = 16
Number of A's = 2
Number of A-'s = 1
Number of B+'s = 1
Number of B's = 3
Number of B-'s = 1
Number of C+'s = 1
Number of C's = 1
Number of C-'s = 2
Number of D's = 2
Number of F's = 2
The highest score is 98
The lowest score is 50
The average is 75.5
This is what I have so far and it is not working correctly:
public static void main(String[] args) {
// scanner
Scanner scnr =new Scanner (System. in);
//ints grades and count
int x;
int A = 0;
int B = 0;
int C = 0;
int D = 0;
int F = 0;
int count = 1;
//int min max total
int min, max;
int total = 0 ;
//double
double average;
//prompt user for input
System. out. print("Please enter the exam scores as integer ");
System. out. print("percentages in the rage 0-100. ");
System. out. println("Please end the list with a negative integer.");
//scnr
x = scnr. nextInt();
min = x;
max = x;
//while loop
while (x >= 0){
x = scnr. nextInt();
if (x >= 0){
total = total + x;
count++;
if (x < min)
min = x;
if (x > min)
max = x; }
while (x >= 90 && x <= 100) {
x = scnr. nextInt();
A++;
//Grade B
if (x >= 80 && x <= 89)
B++;
//Grade C
if (x >= 70 && x <= 79)
C++;
//Grade D
if (x >= 60 && x <= 69)
D++;
//Grade F
if (x >= 0 && x <= 59)
F++;
}
}
// average
average = total/count;
//results/output
System. out. println("Total number of grades: " + count);
System. out. println("Number of A's: " + A);
System. out. println("Number of B's: " + B);
System. out. println("Number of C's: " + C);
System. out. println("Number of D's: " + D);
System. out. println("Number of F's: " + F);
System. out. println("Highest score: " + max);
System. out. println("Lowest score: " + min);
System. out. println("Average: " + average);
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
Chloe is building a kiosk-based excel application. she wants to make some modifications to the screen elements in order to keep users from being distracted by parts of the application that are irrelevant to her application. she turns to henry for guidance as she knows he built a similar solution earlier this year.chloe has decided to hide the worksheet gridlines and the vertical scroll bar. what does henry tell her to use to do this? a) screen elements dialog boxb) display options dialog boxc) customization dialog boxd) excel options dialog box
Answers: 2
question
Computers and Technology, 22.06.2019 15:00
Atool that matches persoal skills qualities interests and talets to a career is called a
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
How to launch an app: steps to be successful? launching an app is a great idea, but it’s not that easy as we supposed to think. the majority of mobile applications don’t generate revenue because companies aren’t ready to be competitive. referring to our experience in successfully building and launching apps we hope to you omit these difficulties. we are going to talk about ideas, marketing, testing your product, its development, distribution and support. you will learn 8 product launch stages to succeed.
Answers: 1
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
You know the right answer?
Write a program to read a list of exam grades given as int's in the range of 0 to 100. Your program...
Questions
question
Mathematics, 29.07.2019 08:00
question
Biology, 29.07.2019 08:00
question
Mathematics, 29.07.2019 08:00
Questions on the website: 13722367