Question: Write a program that reads a sequence of floating point numbers from the keyboard and outputs the average and the maximum element in the sequence.

Write a program that reads a sequence of floating point numbers from the keyboard and outputs the average and the maximum element in the sequence. The sequence has at least one number and is terminated by 0(0 will not appear in the sequence other than as the end marker).
Use the following statements so that the program displays the values with two digits after the decimal points.
System.out.printf("Average: %.2f
", average);
System.out.printf("Maximum: %.2f
", max);
Check the Test Cases Console on the right for more details. The test cases will show when you click on the task.

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 Programming Questions!