Question

This program has to be made in java also will but uploaded on zybooks Write a...

This program has to be made in java also will but uploaded on zybooks

Write a program in Java 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:

A

93 <= 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

Please note that your class should be named Grades.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.Scanner;

public class GradeCount {
   public static void main(String[] args) {
       // counters for each grade
       int a = 0, an = 0, bp = 0, b = 0, bn = 0, cp = 0, c = 0, cn = 0, d = 0, f = 0;
       int grade, total = 0;
       Scanner sc = new Scanner(System.in);
       while (true) {
           System.out.println("Enter Grades (negative number to quit): ");
           grade = sc.nextInt();
           // exit loop if it is <0
           if (grade < 0)
               break;
           //increasing the respective counter variable
           if (grade >= 93)
               a++;
           else if (grade >= 90)
               an++;
           else if (grade >= 87)
               bp++;
           else if (grade >= 83)
               b++;
           else if (grade >= 80)
               bn++;
           else if (grade >= 77)
               cp++;
           else if (grade >= 73)
               c++;
           else if (grade >= 70)
               cn++;
           else if (grade >= 60)
               d++;
           else
               f++;
           total++;
       }
       System.out.println("Total number of grades = " + total);
       System.out.println("Number of A's = " + a);
       System.out.println("Number of A-'s = " + an);
       System.out.println("Number of B+'s = " + bp);
       System.out.println("Number of B's = " + b);
       System.out.println("Number of B-'s = " + bn);
       System.out.println("Number of C+'s = " + cp);
       System.out.println("Number of C's = " + c);
       System.out.println("Number of C-'s = " + cn);
       System.out.println("Number of D's = " + d);
       System.out.println("Number of F+'s = " + f);
   }
}

Add a comment
Know the answer?
Add Answer to:
This program has to be made in java also will but uploaded on zybooks Write a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a java program to read a list of exam grades given as int's in the...

    Write a java 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: A 93 <= grade <= 100 A- 90 <= grade < 93 B+ 87 <= grade < 90 B 83 <= grade < 87 B- 80 <= grade < 83 C+ 77 <= grade < 80 C 73 <=...

  • write a program that uses a function to read in the grades for four classes and...

    write a program that uses a function to read in the grades for four classes and then uses a function to calculate the average grade in each of the classes. input the grades for one student. we will name her Beverly. output how Beverly's grade differs from each classe average. Make sure that your output is very clear. Below is your data: English 90 70 85 45 95 95 82 97 99 65 History 63 94 60 76 83 98...

  • Please help me with this program.You are to write a C++ program that will read in...

    Please help me with this program.You are to write a C++ program that will read in up to 15 students with student information and grades. Your program will compute an average and print out certain reports. Format: The information for each student is on separate lines of input. The first data will be the student�s ID number, next line is the students name, next the students classification, and the last line are the 10 grades where the last grade is...

  • Write a program to calculate students’ average test scores and their grades. You may assume the...

    Write a program to calculate students’ average test scores and their grades. You may assume the following data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Use three...

  • Write a program to calculate students’ average test scores and their grades. You may assume the...

    Write a program to calculate students’ average test scores and their grades. You may assume the following data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Use three...

  • use  JOptionPane to display output Can someone please help write a program in Java using loops, not...

    use  JOptionPane to display output Can someone please help write a program in Java using loops, not HashMap Test 1 Grades After the class complete the first exam, I saved all of the grades in a text file called test1.txt. Your job is to do some analysis on the grades for me. Input: There will not be any input for this program. This is called a batch program because there will be no user interaction other than to run the program....

  • Student average array program

    Having a bit of trouble in my c++ class, was wondering if anyone can help.Write a program to calculate students' average test scores and their grades. You may assume the following input data:Johnson 85 83 77 91 76Aniston 80 90 95 93 48Cooper 78 81 11 90 73Gupta 92 83 30 68 87Blair 23 45 96 38 59Clark 60 85 45 39 67Kennedy 77 31 52 74 83Bronson 93 94 89 77 97Sunny 79 85 28 93 82Smith 85 72...

  • Develop an interactive program to assist a Philosophy professor in reporting students’ grades for his PHIL-224.N1...

    Develop an interactive program to assist a Philosophy professor in reporting students’ grades for his PHIL-224.N1 to the Office of Registrar at the end of the semester. Display an introductory paragraph for the user then prompt the user to enter a student record (student ID number and five exam-scores – all on one line). The scores will be in the range of 0-100. The sentinel value of -1 will be used to mark the end of data. The instructor has...

  • Java Programming Language Edit and modify from the given code Perform the exact same logic, except...

    Java Programming Language Edit and modify from the given code Perform the exact same logic, except . . . The numeric ranges and corresponding letter grade will be stored in a file. Need error checking for: Being able to open the text file. The data makes sense: 1 text line of data would be 100 = A. Read in all of the numeric grades and letter grades and stored them into an array or arraylist. Then do the same logic....

  • Java please 9:55 Note @13 simple lists of numbers. If the user selects option 2, your...

    Java please 9:55 Note @13 simple lists of numbers. If the user selects option 2, your program should prompt for a list of integer grades (0 100, inclusive). When the list is entered print out the following statistics: total grades, the breakdown of grades by letter both count and percentage), the highest and lowest grades in the list, and the class average Example #1 Please enter a list of grades (0-100): 55 65 75 85 95-1 Total number of grades...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT