Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago