Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that prompts the user to enter an arbitrary number of positive d

ID: 3651591 • Letter: W

Question

Write a program that prompts the user to enter
an arbitrary number of positive double numbers. When the user enters a negative number the
input is complete. At this point the program should display the count, maximum, minimum,
sum, product, average and range (distance between maximum and minimum) of the numbers.
Assume the user enters properly-formatted numbers as input. Hint: most of this work can be
done inside of a single loop.

my loop isnt working properly would appreciate help with this question. Thanks

Explanation / Answer

import java.util.*; public class compute { public static void main(String args[]) { Scanner s = new Scanner(System.in); System.out.println("Enter positive double Numbers( enter negative to quit ):"); double a=s.nextDouble(); int count=0; double max=0; double min=100000000; double sum=0; double product=1; double average; double range; while(a>=0) { count++; if(a>max) max=a; if(a
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote