Question

In: Computer Science

Develop a program Grades.java that collects the user's (students) name, course name, and the score for...

Develop a program Grades.java that collects the user's (students) name, course name, and the score for three quizzes. You are supposed to read this data from the keyboard using the Scanner class. Calculate the total score and the average score.

Further, using the grading scale below, based on the average score computed above, your program should calculate and output a letter grade. and the range boundaries should be configured properly (i.e.: exactly 90 and above is an A, and anything less than 90 to exactly 80 is a B). The grading scale to use is as follows:

Letter Category

Average Score Range

A 90 - 100
B 80 - 90
C 70 - 80
D 60 - 70
E 0 - 60

Note: The E Category is not a typo.

Declare the variables in the order studName, courseName, scoreQuiz_1, scoreQuiz_2, and scoreQuiz_3, totalScore, averageScore, and letterCategory. Make sure you declare the variables studName, courseName, and letterEvaluation as String class variables. Select proper data type for the variables totalScore and averageScore. The data type should support decimals. Use a constant variable NUM_OF_Quizzes to compute the average score.

Things to watch for: As you are determining your logic for your if statements in this project, consider that a percentage of 90.0 results in an A, 89.8 results in a B category, 79.12 results in a C category, and 69.994949 results in a D category. That last example is a bit extreme, but the idea is to not try to predict how many 9s after the decimal you need to account for. Just think of where the last boundary ends and where the next one begins, and how you might use your mathematical operators to account for that (is it less-than-or-equal-to, or just less than?).

Formatting: Import the package DecimalFormat to format the average score data. You do this by typing: import java.text.DecimalFormat; either below or above the line: import java.util.Scanner;

Then create a DecimalFormat object by typing: DecimalFormat df = new DecimalFormat("##.00"); either above or below the line Scanner scnr = new Scanner(System.in);

A format with 2 digits would be displayed by using the df as follows:

System.out.println("The average score is: "+df.format(averageScore));

Pseudocode: Prior to writing the Java code for the project, develop a document in pseudocode that outlines how the program will flow. Remember that there are no specific rules regarding pseudocode, but rather you should write pseudocode in a way that is human-readable and understandable (English for this assignment).

The following example is what your program might look like:

____________________________________________________________________________________

Your Score Card for Three Quizzes

Please enter your name : Julie Kimbal

Please enter your course you are taking : CS1400 Fundamentals of Programming

Please enter the score for quiz 1 : 77

Please enter the score for quiz 2 : 85

Please enter the score for quiz 3 : 79

The total score is 241.0

The average score is : 80.33

Thanks Julie Kimbal. Your grade for the 3 quizzes in CS1400 Fundamentals of Programming is a (n) B.

________________________________________________________________________________________________________________________

Experiment cases: Make sure that your program computes correct average scores for the following experiment cases:

Quiz 1 Quiz 2 Quiz 3 Average Category
Experiment case 1 67 58 54 59.67 E
Experiment case 2 78 71 83 77.33 C
Experiment case 3 89 90 93 90.67 A

You need to upload three files:

  1. attach a screenshot of one output
  2. pseudocode document
  3. java file (not the class file) Grades.java

Solutions

Expert Solution

Thanks for the question.
Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks!
===========================================================================

import java.text.DecimalFormat;
import java.util.Scanner;

public class Grades {

    public static void main(String[] args) {

        //studName, courseName,
        String studName, courseName;
        // scoreQuiz_1, scoreQuiz_2, and scoreQuiz_3,
        int scoreQuiz_1, scoreQuiz_2, scoreQuiz_3;
        // totalScore, averageScore,
        double totalScore, averageScore;
        // and letterCategory
        char letterCategory;
        //NUM_OF_Quizzes
        final int NUM_OF_QUIZZES = 3;

        //Then create a DecimalFormat object
        DecimalFormat df = new DecimalFormat("##.00");
        //either above or below the line Scanner scnr = new Scanner(System.in);
        Scanner scnr = new Scanner(System.in);

        System.out.println("Your Score Card for Three Quizzes");
        System.out.print("Please enter your name: ");
        studName = scnr.nextLine();
        System.out.print("Please enter your course you are taking : ");
        courseName = scnr.nextLine();
        System.out.print("Please enter the score for quiz 1: ");
        scoreQuiz_1 = scnr.nextInt();
        System.out.print("Please enter the score for quiz 2: ");
        scoreQuiz_2 = scnr.nextInt();
        System.out.print("Please enter the score for quiz 2: ");
        scoreQuiz_3 = scnr.nextInt();

        totalScore = (scoreQuiz_1 + scoreQuiz_2 + scoreQuiz_3);
        averageScore = totalScore / NUM_OF_QUIZZES;
        if (averageScore >= 90) letterCategory = 'A';
        else if (averageScore >= 80) letterCategory = 'B';
        else if (averageScore >= 70) letterCategory = 'C';
        else if (averageScore >= 60) letterCategory = 'D';
        else letterCategory = 'E';

        // display output
        System.out.println("The total score is " + df.format(totalScore));
        System.out.println("The average core is : " + df.format(averageScore));
        System.out.println("Thanks " + studName + ". Your grade for the 3 quizzes in " +
                courseName + "  is a(n) " + letterCategory);
        System.out.println();

    }
}

===================================================================


Related Solutions

Design and implement an interactive program named trip.c that collects information about the user's car and...
Design and implement an interactive program named trip.c that collects information about the user's car and planned travel, and reports back useful information. The dialog below shows exactly what data should be collected as input and reported as output. Some Hints to get started /* Not tested not complete code Just to get you started */ #include /* FUNCTION PROTOTYPES */ void WelcomeMessage(); void AskUserForInput(); /* ask and check whether user wants to continue if wants to continue gather information...
ASSIGNMENT: Write a program to ask for the name and test score for 8 students, validate...
ASSIGNMENT: Write a program to ask for the name and test score for 8 students, validate that the test score is between 0.0 and 100.0 inclusive, and store the names and test scores in 2 parallel arrays. Then, calculate and display the average of the test scores. Finally, display all the students who have test scores above the average. Example Run #1: (bold type is what is entered by the user) Enter student name #1: George Enter the score for...
Write a Python program that has the user enter their name.   Using the user's name calculate...
Write a Python program that has the user enter their name.   Using the user's name calculate the following: 1. How many letters are in the user's name? 2. Print the user's name in REVERSE both in capital letters and lowercase letters 3. Print the ASCII value for each letter of the user's name. 4. Print the SUM of all of the letters of the user's name (add each letter from #3)
Consider the relationship between students’ score on a first course exam and their score on the...
Consider the relationship between students’ score on a first course exam and their score on the final exam. First-test score               Final-exam score 153                              145 144                              140 162                              145 149                              170 127                              145 118                              175 158                              170 153                              160 Using (1) your calculator, a pencil and graph paper and then (2) Excel: Plot the data with the first-test score on the x axis and the final-exam score on the y axis. Find the arithmetic mean, the mean absolute deviation and...
C++ : Write a program that creates a login name for a user, given the user's...
C++ : Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first five letters of the last name, followed by the first letter of the first name, and then the last two digits of the number (use the % operator). If the last name has less than five letters, then use all letters of the...
Develop a program that calculates the final score and the average score for a student from...
Develop a program that calculates the final score and the average score for a student from his/her (1)class participation, (2) test, (3) assignment, (4) exam, and (5) practice scores. The user should enter the name of the student and scores ranging from 0 to 100 for each grading item. The final score is the sum of all grading items. The average score is the average of all grading items. Here is a sample output of the program: Enter the Student's...
Problem 2 (Save and Get Info) : Write a program that asks for the user's name,...
Problem 2 (Save and Get Info) : Write a program that asks for the user's name, phone number, and address. The program then saves all information in a data file (each information in one line) named list.txt. Finally, the program reads the information from the file and displays it on the screen  in the following format: Name: User's Name   Phone Number: User's Phone Number   Address: User's Street Address User's City, State, and Zip Code
The score of a course out of 100 in Winter of 10 students are 48, 92,...
The score of a course out of 100 in Winter of 10 students are 48, 92, 47, 44, 94, 18, 95, 67, 74, 64 a. Calculate Q1, Q3 and IQR of the data. b. Find the mean, median and standard deviation c. Determine whether the smallest value of this data set is an outlier. d. Comment the shape of the distribution.
Modify the Assignment program from Module 1 to read a user's first and last name read...
Modify the Assignment program from Module 1 to read a user's first and last name read three integer scores, calculate the total and average determine the letter grade based on the following criteria - Average 90-100 grade is A, 80-89.99 grade is B, 70-79.99 grade is C, all others F (use a nested if) Output formatted results consisting of the full name, the three scores, the total, average (to 2 decimal places), and the letter grade go to step 1...
C++ Read first a user's given name followed by the user's age from standard input. Then...
C++ Read first a user's given name followed by the user's age from standard input. Then use an ofstream object named outdata (which you must declare) to write this information separated by a space into a file called outdata. Assume that this is the extent of the output that this program will do. Declare any variables that you need.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT