Question: write in java Write a small program that continually reads in user values and calculates these four values. The program should first ask the user

write in java
write in java Write a small program that continually reads in user

Write a small program that continually reads in user values and calculates these four values. The program should first ask the user for the number of values to be entered. Upon storing this value, the program should proceed to read in that many numbers from the user. Once all the inputs are done, the program then prints the following five values. [1] smallest number [2] largest number [3] sum of all the numbers [4] average of all the numbers [5] range of the numbers (difference between the largest and smallest numbers) Implementation Strategy: [1] You should use a for loop because we know the number of values we need to read. [2] Don't store all the values input by the user (since it is not required to show all the input numbers). We just need to keep track of the above five values. [3] Once the for loop is done, print these five values. Error Checking: You need to check for the following errors. [1] Since we are calculating the range, the minimum count of numbers to be entered by the user should be 2. If the user enters the count of numbers as 1, throw an error. [2] Also the count of numbers should not be negative. Throw an error in such case. Documentation: Ensure that logical blocks of the code are documented in the code itself. Naming Conventions: Ensure that you name your variables per the java coding conventions

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!