Question: Write a java program to read whole numbers (integers) until a sentinel (any negative number can act as sentinel) is entered and perform the following:

Write a java program to read whole numbers (integers) until a sentinel (any negative number can act as sentinel) is entered and perform the following:

(1) Display a menu for the user as follows:

0 for two-digit numbers

1 for three-digit numbers

2 for four-digit numbers

3 for more than four digits

4 sentinel (any negative number)

If the user selects an option and enters an invalid number, display an appropriate error message, and reject the input.

(2) Display sum of the even numbers between 10 and 999.

(3) Display sum of the odd number less than 9999.

(4) Display average of the three-digit numbers.

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!