Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAMMING Math Tool As a software developer, you have received a new requirement from an Elementary School to develop a software to help kids

JAVA PROGRAMMING

Math Tool As a software developer, you have received a new requirement from an Elementary School to develop a software to help kids to learn about whole number concepts, such as odd numbers, even numbers, find the greatest number and compute the average. The Elementary School wants you to build a program that prompts the user to enter his/her name (Student name) and to enter a series of whole numbers. Thus, your program will receive the following information:

Student name Whole numbers entered at the keyboard.

Note: The Student will enter 99 to finish entries and exit the program. The program then outputs the following information:

Student name A count of how many numbers were entered A count of how many even numbers were entered A count of how many odd numbers were entered. The sum of the numbers entered. The average of the numbers entered. The sum of the odd numbers entered. The average of the odd numbers. The sum of the even numbers entered. The average of the even numbers entered. The largest odd number entered. The largest even number entered.

Notes You MUST store all calculations in variables (i.e. do not calculate the price of menu items, sales tax, or total amount due directly in your System.out.println statements) You do NOT need to worry about formatting the decimal places on values you calculate You may perform the tasks in any order as long as your output follows the order of the output in the example scenarios contained in the Sample Output (Shown below)

Extra credit (10 Points) Use an Input Dialog box to allow the user to enter the numbers: Title: Fun Math Message: Please enter a positive integer number, or 99 to exit. Test what the user input and if it is not a positive integer, display a Message Dialog box Title: Warning, wrong entry! Message: Please enter only positive numbers or 99 to exit.

SAMPLE OUTPUT:

Scenario 1: Student enters 4 numbers (2 odd and 2 even). All positive numbers ************************************* Please enter student name: Bradly ************************************* Hello, Bradly This program will run until you type 99 Please enter a positive number: 5 Please enter a positive number: 15 Please enter a positive number: 4 Please enter a positive number: 16 Please enter a positive number: 99 ********************************************************* * SUMARY REPORT * ********************************************************* You entered 4 numbers 2 of them are even numbers 2 of them are odd numbers The sum of the numbers is: 40 The average of the numbers is: 10.0 The sum of the odd numbers is: 20 The average of the odd number is: 10.0 The sum of the even numbers is: 20 The average of the even number is: 10.0 The greatest odd number is 15 The greatest even number is 16 *********************************************************

Scenario 2: Student enters negative numbers *************************************

Please enter student name: Chris ************************************* Hello, Chris This program will run until you type 99 Please enter a positive number: -4 Sorry, the number must be > 0 Please enter a positive number: 4 Please enter a positive number: 9 Please enter a positive number: 15 Please enter a positive number: 11 Please enter a positive number: 12 Please enter a positive number: 99 ********************************************************* * SUMARY REPORT * ********************************************************* You entered 5 numbers 2 of them are even numbers 3 of them are odd numbers The sum of the numbers is: 51 The average of the numbers is: 10.2 The sum of the odd numbers is: 35 The average of the odd number is: 11.666666666666666 The sum of the even numbers is: 16 The average of the even number is: 8.0 The greatest odd number is 15 The greatest even number is 12 *********************************************************

Scenario 3: Student enters 0 numbers, enters 99 ************************************* Please enter student name: Kevin Doherty ************************************* Hello, Kevin Doherty This program will run until you type 99 Please enter a positive number: 99 ********************************************************* * SUMARY REPORT * ********************************************************* You entered 0 numbers 0 of them are even numbers 0 of them are odd numbers The sum of the numbers is: 0 The average of the numbers is: 0.0 The sum of the odd numbers is: 0 The average of the odd number is: 0.0 The sum of the even numbers is: 0 The average of the even number is: 0.0 The greatest odd number is 0 The greatest even number is 0 *********************************************************

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

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions