Question: Can someone write the Java code out for this project? Please DO NOT USE Arrays when evaluating this lab. Part 2: Statistics Write a program

Can someone write the Java code out for this project? Please DO NOT USE Arrays when evaluating this lab.

Can someone write the Java code out for this project? Please DO

Part 2: Statistics Write a program named Statistics.java that repeatedly asks a user to enter a price of an item or -1 when finished When the user enters -1, your program will compute and display the total number of items, the average price, and the standard deviation of the prices. Here is the formula for standard deviation: nt Note: the original formula in the assignment was for the variance--the standard deviation is the square root of the variance. (Edited 3 October) If the user enters -1 right away, print a message that you cannot calculate any statistics. If the user enters only one number, calculate the average, but give a message that you cannot calculate a standard deviation Here is some sample output from running the program several times Enter first price, or -1 to quit: $15.20 Enter next price, or -1 to quit: $16.45 Enter next price, or -1 to quit: $17.00 Enter next price, or -1 to quit: $15.85 Enter next price, or -1 to quit: $-1 Number of items: 4 Average price is $16.13 Standard deviation of prices is $0.78 Enter first price, or -1 to quit: $34 Enter next price, or -1 to quit: $-1 Number of items: 1 Average price is $34.00 Cannot calculate standard deviation for one item Enter first price, or -1 to quit: $-1 Number of items: 0 No data entered. Cannot calculate statistics. Hint: Your program needs variables to keep track of the number of items entered, the sum of the items, and the sum of squares. Every time you get a price (other than -1), your program will have to add one to the total number of items, adod the price to the sum, and add price2 to the sum of squares. Your program should not calculate the average or standard deviation until all the numbers have been entered

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!