Question
Java I - Write a Java program that will first ask the user how many grades they want to enter. Then use a do..while loop
Java I - Write a Java program that will first ask the user how many grades they want to enter. Then use a do..while loop to populate an array of that size with grades entered by the user. Then sort the array. In a for loop read through that array, display the grades and total the grades. After the loop, calculate the average of those grades and display that average.
---------------
-
Prompt the user for the number of grades they would like to find the average of. This will be the length of the array you want to create.
-
Create an array of the proper size to hold the grades the user will enter.
-
Set up a do..while loop to read in the grades that will populate the array.
-
Sort the array using the Arrays.sort method.
-
Set up a for loop to iterate through the array you just created and accumulate those grades.
-
Find the average of those grades.
-
Use: good variable names, indentations of four spaces, comments within the program code, and label the output appropriately.
-
Output all of the grades, sorted from lowest to highest, and then the average. Label the output so that anyone reading it would understand what they were looking at.
-
Add lots of comments so that anyone reading it would understand what they were looking at.
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