Question: In this assignment, you will use the Scanner class to get five positive integers from the user. You then compute the sum, product, and average

In this assignment, you will use the Scanner class to get five positive integers from the user. You then compute the sum, product, and average of the five positive integers and report them. A positive integer is an integer that is greater than zero. There are some example programs in Recitation 2: User input with Scanner, and you are encouraged to use them as references. You can open them up in Eclipse (download and put the example programs in your workspace->project->package->src folder), then open your assignment program side by side. Read through the example programs and adapt them for the purpose of this assignment. Requirements 1. The name of your Java class is "GiveMeFive". (So the file name is "GiveMeFive.java") 2. Print out instructions for the user to enter five positive integers. 3. Use the Scanner class to get five integers from user input. If you forgot: there are three steps when you use a Scanner. Refer to Recitation 2: User input with Scanner 4. Compute the sum, product, and average of the five integers. You need to look up the formulas on Google if you do not remember them. Be careful that the average of five integers can be a fractional number (that is, type double). 5. Report the sum, product and the average with meaningful English sentences printed to the console. Printing only the result numbers is not enough. For example, you may print "The product is 120" for the product, and that's a meaningful sentence. Console Example Please enter five positive integers: 2 2 3 4 5 The sum is 16 The product is 240 The average is 3.2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
