Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

How is workforce planning linked to strategic planning?

Answered: 1 week ago