Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

//**************************************************************************

//

// DESCRIPTION: Program reads integers and performs sum of the even and odd numbers

// and the average

// CLASS: COSC 1437

// AUTHOR:

//

//**************************************************************************

public static void main(String[] args) {

// add your statements here

}

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

What is Ramayana, who is its creator, why was Ramayana written?

Answered: 1 week ago

Question

To solve by the graphical methods 2x +3y = 9 9x - 8y = 10

Answered: 1 week ago

Question

=+ Are there closed-shop requirements or practices?

Answered: 1 week ago