Question
JAVA write a program that utilizes 2 arrays, each array will be one-dimensional. One array will contain student names, the other student test grades. These
JAVA write a program that utilizes 2 arrays, each array will be one-dimensional. One array will contain student names, the other student test grades. These will be parallel arrays. With this in mind, complete the following: Write a program that prompts the user to input a student first name followed by a space and an integer test grade, then the user will press enter and you will prompt them again for a name and a test grade; for a total of 10 students and 10 grades. (Ex: Dawn 100 ) ; You must check that the user enters a grade that is >= 0 and <= 100. If not, you must prompt the user with an error message and the user must input the grade again.
Once you have all the student names and grades, you are to find the classAverage() test grade and the highestGrade() and lowestGrade(). You must use an array to store the student names and another array to store the student grades. Recall that average is the sum of the values divided by the number of values. Use a sort() method to sort both arrays (remember that each array holds a name related to a grade. If you move a grade in one array, you should move the name to the corresponding index in the name array) You will write a method classAverage() which should return the average test grade based on all the values in the array of test grades. You are also expected to create a method highestGrade(), which will find the highest grade in the test grades array and print the highest grade and ALL the students names that have the highest grade on the test.
Test your program using the test data given below and call the classAverage() and highestGrade() methods defined above passing in the arrays. You must use the test data that I give you below.
These are the values to prompt the user with:
Bill 70
Dawn 100
John 90
Samir 100
David 98
Ayesha 100
Tony 99
Lisa 88
Ravi 97
Bob 60
Example of what your output should look like:
The Student Grades are:
Bill 70
Dawn 100
John 90
Samir 100
David 98
Ayesha 100
Tony 99
Lisa 88
Ravi 97
Bob 60
The Average Test Grade is:
90.2
The highest test grade is 100
The lowest test grade is 60
Students scoring the highest grade are Dawn, Samir, Ayesha
The sorted values are :
Bob 60
Bill 70
Lisa 88
John 90
Ravi 97
David 98
Tony 99
Ayesha 100
Samir 100
Dawn 100
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