subject

Allow a user to enter any number of double values up to 20. The user should enter 99999 to quit entering numbers. Display an error message if the user quits without entering any numbers; otherwise, display each entered value and its distance from the average. im using cengage and its only 15% correct but it works?import java. util. Scanner;public class DistanceFromAverage{public static void main(String[] args){double[] input = new double[20];int sentinal = 99999;double value;double total =0;int counter =0;boolean repeat=true;Scanner keyboard = new Scanner(System. in);// read valuesfor (int i = 0; i < input. length && repeat; i++) {System. out. print("Enter a value(99999 to exit):");value = keyboard. nextDouble();// breaks when values is 99999if (value == sentinal) {repeat=false;} else {input[i] = value;total += input[i];counter++;}}double average= total/counter;if (counter == 0)System. out. println("Error! Please enter any values");else {// calculate averageSystem. out. printf("%-10s%-20s\n","value","Dist ance from average");// calculate distancefor (int a = 0; a < counter; a++) {System. out. printf("%-10.2f%-10.2f\n",input[a], average-input[a]);

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
One subtask in the game is to roll the dice. explain why is roll the dice an abstraction.
Answers: 3
question
Computers and Technology, 22.06.2019 22:30
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
question
Computers and Technology, 24.06.2019 01:30
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
You know the right answer?
Allow a user to enter any number of double values up to 20. The user should enter 99999 to quit ente...
Questions
question
Social Studies, 03.02.2020 07:58
question
Social Studies, 03.02.2020 07:58
question
Biology, 03.02.2020 07:58
question
Mathematics, 03.02.2020 07:58
Questions on the website: 13722361