Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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. 31 Once the for loop is done, print these five values. Error Checking: You need to check for the following errors. TI] 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions