Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete Java program called CalculateAverage according to the following guidelines. The program prompts the user for five to ten numbers, all on one

Write a complete Java program called CalculateAverage according to the following guidelines. The program prompts the user for five to ten numbers, all on one line, and separated by spaces. Then, the user calculates the average of those numbers, and displays the numbers and their average to the user. The program uses methods to: get the numbers entered by the user; calculate the average of the numbers entered by the user; and print the results with the whole number, a decimal, and two decimal positions. The first method should take no arguments and return a String of numbers separated by spaces. The second method should take a String as its only argument and return a double (the average). The third method should take a String and a double as arguments but have no return value. For example, if the user input is... 20 40 60 80 100 ...the program should give as output... The average of the numbers 20 40 60 80 100 is 60.00.

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

ISBN: 1285427106, 978-1285427102

More Books

Students also viewed these Databases questions