Question: Write a Java program that contains a while loop that can be controlled using a sentinel value. Write your loop so that only positive, even

Write a Java program that contains a while loop that can be controlled using a sentinel value. Write your loop so that only positive, even values are summed up and the resulting average of those numbers is output to the console once the sentinel value of 672is entered. After the loop exits, provide an output that includes descriptive text, the calculated sum, and the calculated average which should be limited to four decimal places.The sentinel value should not be included in any calculations. For instance, the input of 4, 2, -5,-7, 8, 3, 7, 672should provide a sum of (4+2+8) = 14 and an average of 14/3 ~= 4.666

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!