Question: Create a Java program that allows the user to input up to 50 double numbers (99999 to exit/calculate) that displays the average of all the

Create a Java program that allows the user to input up to 50 double numbers (99999 to exit/calculate) that displays the average of all the numbers entered,

and also each numbers distance from from the average.

Output should look like the picture below.

Create a Java program that allows the user to input up to

Must use/finish the code below using the variables listed.

import java.util.*; public class HowFarFromAverage { public static void main (String[] args) { //create an array of double values up to 20 double[] numbers = new double[20]; double entry; //allows for double entry double total = 0; //certain number X total is 0 double average = 0; //certain number X average is 0 final int QUIT = 99999; //user enter 99999 to quit int x = 0, y; //x is the value of 0 //display message to enter value or quit Scanner input = new Scanner(System.in); System.out.print("Enter a numeric value or " + QUIT + " to quit >> "); entry = input.nextDouble(); //user inputs the next double number while(entry != QUIT && x > "); entry = input.nextDouble(); } } if(x == 0) //display error average statement when no number is entered System.out.println(????????); else { //define the average total / x average = total / x; //display statement for average for the numbers plus average System.out.println(??????); //define for loop y to x for(y = 0; y Enter a numeric value or 99999 to quit >> 78 Enter next numeric value or 99999 to quit >> 56 | Enter next numeric value r 99999 to quit >> 45 Enter next numeric value or 99999 to quit >> 99999 You entered 3 numbers and their average is 59.666666666666664 78.0 is 18.333333333333336 away from the average 56.0 is-3.6666666666666643 away from the average 0 is -3.666666668336 away from the 45.0 is -14.666666666666664 away from the average jGRASP operation complete

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!