First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects). Then create a new Java application called "AverageWithMethods" (without the quotation marks) 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 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.  [CASE 2] The second method should take a String as its only argument and return a double (the average).  [CASE 4]   The third method should take a String and a double as arguments but have no return value.          [CASE 3] 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. BE SURE TO INCLUDE THE OUTPUT FROM MULTIPLE PROGRAM RUNS AS A COMMENT BLOCK AT THE BOTTOM OF YOUR SOURCE CODE FILE.

Question

First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).

Then create a new Java application called "AverageWithMethods" (without the quotation marks) 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:

  1. Get the numbers entered by the user
  2. Calculate the average of the numbers entered by the user
  3. 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.  [CASE 2]

The second method should take a String as its only argument and return a double (the average).  [CASE 4]  

The third method should take a String and a double as arguments but have no return value.          [CASE 3]

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.

BE SURE TO INCLUDE THE OUTPUT FROM MULTIPLE PROGRAM RUNS AS A COMMENT BLOCK AT THE BOTTOM OF YOUR SOURCE CODE FILE.

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times vary by subject and question complexity. Median response time is 34 minutes and may be longer for new subjects.

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Within the NTDS folder, which file stores the main Active Directory database? Group of answer choice...

A: Within the NTDS folder, the “Ntds.dit”file stores the main Active Directory database .Hence, option ...

Q: Question 5, output in C++

A: C++ PROGRAM:#include<iostream>void swap(int a, int b) {int tmp = b;b = a; a = tmp;return;}void...

Q: In Python Define a function writeScores with two parameters. The first should be the name of a file,...

A: Below is the approach and python code:Approach:Define a function “writeScores” having two parameters...

Q: Write a Java program that prompts the user for the page size used in a virtual memory system; this w...

A: A Java program that accepts a valid system page size and virtual address and calculates the page num...

Q: What folder contains group policy templates, logon/logoff scripts, and DFS synchronization data? Gro...

A: “System Volume (SYSVOL)” folder contains group policy templates, logon scripts, and Distributed File...

Q: WRITE A SHORT NOTE ON THE PRIMITIVE COMPONENTS OF BITCOIN VALUE CHAIN?

A: Bitcoin Value Chain can be defined with the help of three terms BlockChain, Private Keys and third M...

Q: Write a method named sumInts that can take a variable number of int arguments and return the sum of ...

A: Below is the approach, and a java program to display the sum of integer arguments, passed in the sum...

Q: What 1s the output of the following code! { String myStr = new String("Cheggers2019") ; System.out.p...

A: There seems to be some error in the question, hence we are proceeding with a small assumption on our...

Q: In MS Access, to ensure that a grade must be either A, B, C, D or F, whichvalidation rule should be ...

A: Microsoft (MS) AccessMicrosoft access is a database management system from Microsoft that combines r...