Question

I asked a question similar to this one, which was answered perfectly. Another practice problem is...

I asked a question similar to this one, which was answered perfectly. Another practice problem is now asking me to use two classes and get user input.

For this Java program, you will write two classes: GradeCalculator and GradeCalculatorDriver

In the GradeCalculator class, compute the final average and letter grade for a particular student.

The final average is calculated according to the following rules:

1) There are ten exams scored out of 100 points

2) The lowest exam score is not included in the calculation of the final average

3) The highest exam score is not included in the calculation of the final average

4) An average of 91-100 is an A

5) An average of 81-90 is a B

6) An average of 71-80 is a C

7) An average of 61-70 is a D

8) An average of 0-60 is an E

The GradeCalculator class must include the following methods:

1) A method to compute and return the highest score

2) A method to compute and return the lowest score

3) A method to compute the sum of all the scores

4) A method to compute the final average

5) A method to determine the letter grade

In the GradeCalculatorDriver class, include a main method that asks the user for the student’s name and their ten exam grades, reads the grades, calculates the letter grade and prints it. This process should be repeated until the user enters N.

For example, a run of the program might look something like this:

Welcome to Score Calculator

Want to compute a final average? Y

Please enter the student’s name: Sara Smith

Please enter test scores all on one line separated by one or more spaces.

The final score for Sara Smith is 100.

The letter grade for Sara Smith is A.

Want to compute another final average? N

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

import java.util.Scanner;
class GradeCalculator{
   int arr2[]=new int[11];
   GradeCalculator(String arr)
   {
       int[] arr1=Integer.parseInt(arr.split(" "));
   }
   int sum=0,sum1=0,sum2=0;
   int high,low;
   float average;
       void highestscore()
       {
           high=arr1[0];
           for(int i=1;i<=10;i++)
           {
               if(arr1[i]>high){
                   high=arr1[i];
               }
           }
       }
       void lowestscore()
       {
           low=arr1[0];
           for(int i=1;i<=10;i++)
           {
               if(arr1[i]<low){
                   low=arr1[i];
               }
           }
       }
       int sumscore()
       {
           for(int i=0;i<10;i++)
               sum=sum+arr1[i];
           return sum;
       }
       float finalaverage()
       {
           average=sum/10;
           return average;
       }
       String lettergrade()
       {
           char letter='a';
           String letter1;
           if(average>91 && average<100){
               letter='A';
           }
           if(average>81 && average<90){
               letter='B';
           }
           if(average>71 && average<80){
               letter='C';
           }
           if(average>61 && average<70){
               letter='D';
           }
           if(average>0 && average<60){
               letter='E';
           }
           letter1=Character.toString(letter);
           return letter1;
       }

}
public class GradeCalculatorDriver{
   public static void main(String args[])
   {
      
       int i;
       System.out.println("Welcome to Score Calculator");
       System.out.println("Want to Compute a final average");
       Scanner in=new Scanner(System.in);
       char s=in.next().charAt(0);
       char s1='Y';
       while(s==s1)
       {
           String letter;
           System.out.println("Enter Student name:");
           String name=in.nextLine();
           System.out.println("Enter test scores all on one line separated by one or more spaces:");
           String arr=in.nextLine();
           GradeCalculator obj=new GradeCalculator(arr);
           int sum=obj.sumscore();
           letter=obj.lettergrade();
           System.out.println("the final score for "+name+"is"+sum);
           System.out.println("the final grade is"+letter);
          
       }
      
   }
}

Add a comment
Know the answer?
Add Answer to:
I asked a question similar to this one, which was answered perfectly. Another practice problem is...
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
  • Java Program: In this project, you will write a program called GradeCalculator that will calculate the...

    Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...

  • Write a grading program in Java for a class with the following grading policies: There are...

    Write a grading program in Java for a class with the following grading policies: There are three quizzes, each graded on the basis of 10 points. There is one midterm exam, graded on the basis of 100 points. There is one final exam, graded on the basis of 100 points. The final exam counts for 40% of the grade. The midterm counts for 35% of the grade. The three quizzes together count for a total of 25% of the grade....

  • C++ Write a program to calculate final grade in this class, for the scores given below...

    C++ Write a program to calculate final grade in this class, for the scores given below . Remember to exclude one lowest quiz score out of the 4 while initializing the array. Display final numeric score and letter grade. Use standard include <iostream> Implementation: Use arrays for quizzes, labs, projects and exams. Follow Sample Output for formatting. May use initialization lists for arrays. Weight distribution is as follows: Labs: 15% Projects: 20% Quizzes: 20% Exams: 25% Final Project: 20% Display...

  • 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...

  • using if/switch statements (C++) Write a grading program for a class with the following grading policies:...

    using if/switch statements (C++) Write a grading program for a class with the following grading policies: There are two quizzes, each graded on the basis of 10 points There is one midterm exam and one final exam, each graded on the basis of 100 points The final exam counts for 50% of the grade, the midterm counts for 25% and the two quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores. They should...

  • Write a program to calculate your final grade in this class. Three(8) assignments have yet to...

    Write a program to calculate your final grade in this class. Three(8) assignments have yet to be graded: Quiz 7, Lab 7 and Final Project. Assume ungraded items receive a grade of 100 points. Remember to drop the lowest two quiz scores. Display final numeric score and letter grade. Implementation: Weight distribution is listed in canvas. Use arrays for quizzes, labs, projects and exams. You are allowed to use initialization lists for arrays. Use at least three (3) programmer defined...

  • DO NOT USE ARRAYS IF YOU KNOW ABOUT ARRAYS, I WANT YOU TO USE 3 VARIABLES,...

    DO NOT USE ARRAYS IF YOU KNOW ABOUT ARRAYS, I WANT YOU TO USE 3 VARIABLES, IT WILL FORCE YOU TO USE COMPOUND LOGICAL STATEMENTS FOR THE IF STATEMENTS. Create a program that will display a menu to the user. The choices should be as follows: Enter 3 grades Show average (with the 3 grades) and letter grade Show highest grade Show lowest grade Exit If you want to put the menu into a function you may. The program should...

  • Create a C++ program to calculate grades as well as descriptive statistics for a set of...

    Create a C++ program to calculate grades as well as descriptive statistics for a set of test scores. The test scores can be entered via a user prompt or through an external file. For each student, you need to provide a student name (string) and a test score (float). The program will do the followings: Assign a grade (A, B, C, D, or F) based on a student’s test score. Display the grade roster as shown below: Name      Test Score    ...

  • c++ implement a student class Determine the final scores, letter grades, and rankings of all students...

    c++ implement a student class Determine the final scores, letter grades, and rankings of all students in a course. All records of the course will be stored in an input file, and a record of each student will include the first name, id, five quiz scores, two exam scores, and one final exam score. For this project, you will develop a program named cpp to determine the final scores, letter grades, and rankings of all students in a course. All...

  • First, create two inputs that can be stored in variables consisting of a student's name. When...

    First, create two inputs that can be stored in variables consisting of a student's name. When the program begins ask "Who is the first student?" followed by "Who is the second student?" You only have to have two students for this program. Ask the user for the scores for the last three test grades for each of the students .   After the user has entered both names, and three scores for each, the program should display the following as output:...

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
ADVERTISEMENT