Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Write a program called StatisticsCalculator that calculates the mean (average) and standard deviation for a set of integer values entered by the user. Your

image text in transcribed

2. Write a program called StatisticsCalculator that calculates the mean (average) and standard deviation for a set of integer values entered by the user. Your program should o Prompt the user for the number of values, n. (n must be 1 or greater!) Output "You must enter an integer greater than 0" and reprompt the user if the number of values is not an integer value greater than 0. o Create an array to store the values. Prompt the user for each value and store it in the array. Output Invalid value and reprompt if the user enters something other than an integer. o Calculate and output the mean of the values with 2 decimal places. o Calculate and output the standard deviation of the values (with 2 decimal places) using the formula given below: N 1 = (X; - )2 i=1 Your program output must match what is shown in the program execution examples below: > java StatisticsCalculator How many values?: 4 Enter value 1: 4 Enter value 2: 5 Enter value 3: 8 Enter value 4: 9 Mean: 6.50 Standard Deviation: 2.06 > java StatisticsCalculator How many values?: You must enter an integer greater than a How many values?: abc You must enter an integer greater than How many values?: 3 Enter value 1: 8 Enter value 2: xyz Invalid value Enter value 2: hi Invalid value Enter value 2: 9 Enter value 3: 2.25 Invalid value Enter value 3: 2 Mean: 6.33 Standard Deviation: 3.09

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_2

Step: 3

blur-text-image_3

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

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago