Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started