Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Write a Java application that reads three integers from the user using a Scanner. Then, create a separate function to calculate the sum, a

Instructions

Write a Java application that reads three integers from the user using a Scanner. Then, create a separate function to calculate the sum, a separate function to calculate the product, and a separate function to calculate the average of the numbers.

For your sum, product, and average functions:

  • Have each function 'return' their respective values.
  • Do not print the results of the sum function in the sum function. Print their results in main(). Same for the product and average functions.
  • Your 3 functions will take integers, but return doubles.
  • Users may enter any valid number, negative or not. Don't worry about checking for unreasonable input for this project.

Once the program has printed it's output, you should ask the user if they wish to run the program again. If they type "y", continue the loop and have the program repeat. If they enter anything other than "y", the program should exit. If the user quits, print a message saying the program has finished/terminated.

Ensure it is from the main function that you use use the three functions to print out the sum, product and average.

Sample Runs

Sample Program Run (user input is underlined)

Enter first number: 5

Enter Second Number: 10

Enter Third Number: 15

Sum is: 30

Product is: 750

Average is: 10

Do you wish to continue? (y/n): y

Enter first number:

Enter first number: 5

Enter Second Number: 10

Enter Third Number: 15

Sum is: 30

Product is: 750

Average is: 10

Do you wish to continue? (y/n): n

-Program Terminated -

in java please

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

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions

Question

3. Did you seek anyones advice?

Answered: 1 week ago

Question

7. What traps should she avoid?

Answered: 1 week ago

Question

5. What decision-making model would you advocate to this person?

Answered: 1 week ago