Question: ***DEADLINE ON TUESDAY MARCH 16TH MAKE SURE WORK IS ACCURATE*** Part 1 GradeConverter class: uses the main method and supporting methods as function calls Create

***DEADLINE ON TUESDAY MARCH 16TH MAKE SURE WORK IS ACCURATE***

Part 1 GradeConverter class: uses the main method and supporting methods as function calls

Create an application/class called GradeConverter that allows the user to enter a numeric grade and then display an appropriate letter grade. The user may then choose to enter another grade or quit.

General Specifications:

  • Prompt user for a numeric grade in the range of 0 to 100, or -1 to end the application. Ensure that the input is acceptable before proceeding.
  • For a valid numeric grade, determine a letter grade based on the common grading scale
    • 90-100 is an A, 80-89 is a B, 70-79 is a C, 60-69 is a D, 59 and lower is an F
  • Display the letter grade and prompt the user to enter a new numeric grade.

Create an algorithm document with the appropriate information (problem statement, assumptions, input, output, test plan, pseudo-code) and submit this file as part of the assignment. The program solution must use two methods as functions:

  • isValidNumber method
    • Accepts three arguments:
      • numeric grade for an assignment (integer)
      • minimum acceptable value (integer)
      • maximum acceptable value (integer)
    • Returns a Boolean answer (true/false) if the numeric grade falls somewhere within this inclusive range
    • Example of a method call: isValidNumber ( 65, 0, 100 )
  • getLetterGrade method
    • Accepts one argument (the numeric grade -- integer)
    • Returns a string containing the appropriate letter grade (A, B, C, D, F).
    • Example of a method call: getLetterGrade ( 65 )

The main method is responsible for the following actions:

  • Prompts user to enter a students numeric grade. If a -1, stop/exit the main method.
  • Calls the isValidNumber method to validate the numeric grade and inform user. If not valid then the user gets an error message and is prompted again for a valid grade.
  • Calls the getLetterGrade method to determine the appropriate letter grade.
    • Display the letter grade in a message along with the numeric grade
  • Continue the process by asking the user for the next numeric grade.

Submit your algorithm file and Java GradeConverter class file.

Part 2: GradeConverterPublic class: contains isValidNumber and getLetterGrade methods GradeConverterDemo class: contains the main method

Use the GradeConverter class Java code from Part 1 as the basis for the following actions. DO NOT delete or modify the GradeConverter class file.

  • Copy the GradeConverter class file and edit as follows
    • Change the class name to GradeConverterPublic and save the file under this name
    • Remove the main method
    • Change the method declarations for isValidNumber and getLetterGrade so that they can be called from other class files in your folder without having to create an object. (i.e. public static methods)
  • Copy the GradeConverter class Java code file and edit as follows:
    • Change the class name to GradeConverterDemo and save the file under this name
    • Remove the isValidNumber and getLetterGrade methods.
    • Change the method calls in the main method to isValidNumber and getLetterGrade that are now located in the GradeConverterPublic class file. Since these are public static methods, they can be accessed without having to create an object of that class.

NOTE: In order to test if they work, GradeConverterPublic and GradeConverterDemo need to be located in the same folder.

Part 3: Using the Part 2 class files, add public static variables accessed within each class file

Use GradeConverterPublic and GradeConverterDemo class files from Part 2 as the basis for the following actions:

  • Edit the GradeConverterPublic class file
    • Add public static Int variables called totalScore and totalStudents to the class. These variables will then be able to be accessed outside of this class and are not related to a specific object.
    • Add an assignment statement to getLetterGrade that both increments totalStudents and adds the score passed to the method to totalScore.
  • Edit the GradeConverterDemo class file
    • Initialize the public static int variables totalScore and totalStudents found in the GradeConverterPublic class.
    • When the user input value is -1 (i.e. end the loop requesting student scores), before ending the program calculate and display messages indicating:
      • The total number of students for which valid scores were entered (i.e. totalStudents in the GradeConverterPublic class)
      • The average score for this group of students (i.e. the totalScore divided by totalStudents in the GradeConverterPublic class)
      • The letter grade associated with this average score (i.e. pass the calculated average grade to the getLetterGrade method in GradeConverterPublic class).

Submit your Java GradeConverterPublic and GradeConverterDemo class files.

***DEADLINE ON TUESDAY MARCH 16TH MAKE SURE WORK IS ACCURATE***

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!