Question: Before attempting this project, be sure you have completed all of the reading assignments, nongraded exercises, discussions, and assignments to date. Write a Java program
Before attempting this project, be sure you have completed all of the reading assignments, nongraded exercises, discussions, and assignments to date.
Write a Java program as follows:
1. Prompt user for the number of students
2. For each student have user enter students name and score (0-100)
3. Store names and scores in separate arrays
4. Code method which gets integer array and uses for-loop to find the index of the smallest value
5. Code method which gets integer array and uses for-loop to find the index of the largest value
6. Output all students with their scores
7. Output which student has highest score and which student has lowest score
Make sure your Java program is using the recommended style such as:
- Javadoc comment up front with your name as author, date, and brief purpose of the
- program
- Comments for variables and blocks of code to describe major functionality
- Meaningful variable names and prompts
- Identifiers are written in upper CamelCase
- Class name starts with upper case letter and variables in lower case letter
- Constants are written in All Capitals
- Use proper spacing and empty lines to make code human readable
Capture execution:
You should capture and label screen capture associated with compiling your code, and running a
test case.
Here is a sample run:
RUN:
How many students do you want to enter: 3
Student 1:
Enter student's name: John Smith
Enter student's score (0-100): 80
Student 2:
Enter student's name: Jane Cebula
Enter student's score (0-100): 98
Student 3:
Enter student's name: Ginny Jones
Enter student's score (0-100): 75
John Smith 80
Jane Cebula 98
Ginny Jones 75
Jane Cebula has the highest score => 98 and Ginny Jones has the lowest score => 75
Guidelines :
- Use an integer variable for number of students. ex: numStudents
- Use an array of Strings to store student names; array size is numStudents. Ex: String names[]
- Use an array of integers (or double) to store scores; array size is numStudents. Ex: int Scores[]
- Use a for loop to read input (using Scanner) for names and scores and store them in the 2 arrays.
- Use a for loop to output the values in both arrays.
- Define 2 methods: One to find max score and second method to find min score. Pass the Scores array to both methods as arguments (array should be a parameter in the methods). In both methods, use for loop to iterate data elements in the Scores[] array and program using an IF statement within the loop.
- Output all required results.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
