Question
[JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: Read
[JAVA/chapter 7]
Assignment: Write a program to process scores for a set of students. Arrays and methods must
be used for this program.
Process:
Read the number of students in a class. Make sure that the user enters 1 or more students.
Create an array with the number of students entered by the user.
Then, read the name and the test score for each student.
Calculate the best or highest score.
Then, Calculate letter grades based on the following criteria:
A when score is >= best score -10
B when score is >= best score -20
C when score is >= best score -30
D when score is >= best score -40
F Otherwise.
Calculate and display the average of test scores.
Use any sorting algorithm such as Bubble Sort or Selection Sort (DO NOT use pre-defined sort methods)
to sort the data by name. Make sure the test scores are also sorted,
accordingly.
Allow the user to enter a student name and displaythe corresponding test score. Issue
an error message if the name is not in the list of students. Use a loop to allow the user to
enter as many names as the user wishes to enter. Use the sentinel value done to exit the
search process.
//
Minimal number of methods to define for this program:
1.A method to return a valid number of students
2.A method to return the name and test scores of the students
3.A method to return the best score
4.A method to display the letter grade along with the score information
5.A method to sort the data
6.A method to display the array of names and test scores
7.A method to search for a given name. This method should return the test score for the
given name or -1 if the name is not found. You can use the returned value in the main
method to display the score or to display an error message.
//
SAMPLE RUN:
Number of students:
-1
Error try gain
Number of students:
0 Error try gain
Number of students: 4
Assume the entered values are: bill, joe, mary, bob
Assume the entered values are: 40 55 70 58 <<<< Note the best score is calculated to be 70
*** Grade Report ***
bill scored 40, grade is: C
joe scored 55, grade is: B
mary scored 70, grade is: A
bob scored 58, grade is: B
Average = 55.75
*** The sorted List ***
bill 40
bob58
joe55
mary 70
Enter a students name: joe
joe received a score of 55
Enter a students name: nancy
nancy is not a student
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started