The program prompts the user for five to ten numbers all on one line, separated by spaces, 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 all on one line separated by spaces;

2) calculate the average of the numbers entered by the user; and

3) print the results.

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.

IF user input is: 20 40 60 80 100

Answers

Answer 1

Answer:  

import java.util.Scanner;  

public class AverageDemo

{  

public static String getNumbers()

{

 

 String numbers;  

 Scanner scn = new Scanner(System.in);  

 System.out.println("Enter five to ten numbers all on one line, separated by spaces: ");

 numbers = scn.nextLine();

 return numbers;

}  

public static double calcAverage(String numbers)

{

 String[] values = numbers.split(" ");

 double total = 0;  

 for (int i = 0; i < values.length; i++)

 {

  total += Integer.parseInt(values[i]);

 }  

 if (values.length == 0)

  return 0.0;

 else

  return (total / values.length);

}  

// Method definition of printResults: print the results

public static void printResults(String numbers, double average)

{

 System.out.printf("\nThe average of the numbers %s is %.2f\n", numbers, average);

}  

// main method

public static void main(String[] args)

{

 // Call the methods

 String numbers = getNumbers();

 double average = calcAverage(numbers);

 printResults(numbers, average);

}

}

Output:

The Program Prompts The User For Five To Ten Numbers All On One Line, Separated By Spaces, Calculates

Related Questions

You install Windows 10 on a new computer. You update the video card driver and restart the computer. When you start the computer, the screen flickers and then goes blank. You restart the computer and receive the same result. You need to configure the video card driver. What should you do first

Answers

First, you need to cut off power to the PSUHit the switch on the back of the PC to turn off supply to the PSU. Extract the side panel (usually held on by two screws on the rear)If you do not already have a GPU installed, skip to Step 7.

3. Remove the screws holding the GPU in on the rear bracket. ...

4. Unlock the PCI-e slot clip.

5. Remove the GPU by lightly pulling on the card.

6. Hover the GPU over PCI-e slot.

7. Push down on the GPU to slide the connector into the slot.

8. Ensure the secure lock clicks into place.

9. Screw the rear bracket down to secure the card to the chassis.

10. Connect any required PSU cables.

11. Reattach the side panel,

Now, all you need to do is to plug in the display connectors on the rear of the case, whether they're DisplayPort, HDMI, DVI, or VGA. After that, hit the PSU power switch and boot up Windows. If the PC does not turn on or no signals get sent to the monitor, we'll need to double-check that all cables are connected correctly (both inside and on the rear of the PC), and the GPU is seated properly in the PCIe slot.

how do you underline the selected text?

Answers

Select the text that you want to underline. Tip: You can also use the keyboard shortcut Ctrl+D. Use the Underline style drop-down list to select an underline style. Use the Underline color drop-down list to change the color of the line.

how is internet connection made possible.​

Answers

Answer:

To connect to the Internet and other computers on a network, a computer must have a NIC (network interface card) installed. A network cable plugged into the NIC on one end and plugged into a cable modem, DSL modem, router, or switch can allow a computer to access the Internet and connect to other computers.

Câu 1: Đất trồng là môi trường?

A. Cung cấp chất dinh dưỡng, ôxy

B. Giúp cây đứng vững

C. Cung cấp chất dinh dưỡng, ôxy, nước

D. Câu B và C

Answers

Answer:

D

Explanation:

the contribution of Charles Babbage in the history of computer​

Answers

Charles Babbage also known as the “father of computers” have made an incredible contribution in the evolution and history of computers. His most well-known invention, the analytical engine was a proposed mechanical general-purpose computer with complex machinal working features. Today, most computers follow Charles Babbage’s analytical engine’s process of working (IPO). Charles Babbage was the one to originate the concept of a digital programmable computer. Other mentionable invention of Charles Babbage is difference engine.


Plz give me the brainliest :)

A user informs you that he or she never deletes any files he or she creates. How might this affect the operating system? It will cause the operating system to crash. It will cause the operating system to upgrade. It will cause the operating system to run faster. It will cause the operating system to run slower.

Answers

Answer:

Depending on the amount of files there are, the operating system will run slower because these files take up space on the hard drive, slowing it down.

Explanation:

A finite set of values along with set of rules for permissible operations is called ______


Data type

Class

Methods

Answers

Answer(data type) is your answer

Data type is the correct answer

what is the georgia connections academy administrative password? i want to install something.

Answers

Answer:

ICL has world-class customized accredited curriculum of over 75 subjects & 1 on 1 support. ICL students compete at the highest level, perform on Broadway & excel in entrepreneurship. Customize Curriculum. Cambridge Style Seminars.

write an algorithm and draw a flowchart for switching off a machine after it has made 500 glass bottles. use an appropriate conditional statement for this

Answers

Answer:

The algorithm is as follows:

1. Start

2. bottles = 0

3. While bottles != 500

  3.1 Create bottle

  3.2 bottle = bottle + 1

4. Switch off machine

5. Stop

See attachment for flowchart

Explanation:

This begins the algorithm

1. Start

This initializes bottles to 0

2. bottles = 0

The loop is repeated until 500 bottles is created

3. While bottles != 500

This creates a new bottle

  3.1 Create bottle

This increments the number of bottles by 1

  3.2 bottle = bottle + 1

This switches of the machine after all bottles are created

4. Switch off machine

End algorithm

5. Stop

You want to make sure that a set of servers only accepts traffic for specific network services. You have verified that the servers are only running the necessary services, but you also want to make sure that the servers do not accept packets sent to those services. Which tool should you use

Answers

Answer:

Port scanner.

Explanation:

A server can be defined as a specialized computer system that provides specific services for its clients on request. An example is a web server.

A web server is a type of computer that run websites and distribute web pages as they requested over the internet by end users (clients). When an end user request for a website by adding or typing the uniform resource locator (URL) on the address bar of a web browser, a request is sent to the internet to view the corresponding web pages (website) associated with that particular address.

In this scenario, the tool you should use is a port scanner because it would scan all packets that are sent or received by the server i.e all packets that are being transmitted to and from the server.

Type the correct answer in each box. Spell all words correctly.

Digital artist Frank is discussing how to enhance scanned or photographed images. Complete the following sentences while keeping in mind the topic of discussion.

You can rework or enhance scanned or photographed images using photo editing and illustration software or by using a digital____.

The device has a_____surface on which you can draw images, graphics, and animations.

Answers

Answer:

1. Tablet

2. Flat

Explanation:

is the process of modifying something to make it fit certain criteria.

Answers

Answer:

Design Process

What is a possible explanation for the issue described below? A user reports that ever since she or he began creating animations, graphics, and video clips for the company’s Web site on her or his computer, the computer has begun running slower, especially when performing the graphics functions. The computer needs an increase in VRAM. The computer needs an increase in SRAM. The computer needs an increase in SIMM. The computer needs an increase in RIMM.

Answers

VRAM because VRAM is used for graphic intensive workloads

Answer:

The computer needs an increase in VRAM

It is A

Shelby wants to move “ExpirationDate” to the top of the datasheet. What should she do?

Answers

Select row for "ExpirationDate", click the mouse and drag the field until the blue line appears above "Scent," and release the mouse button.

Encryption is a process
i. To hide the massage
ii. To decipher the massage
iii. To delete the massage
iv. None of them​

Answers

Answer:

answer is i

Explanation:

jjgjnyjghjhkgukhi

Answer:

Encryption is a process by which we can conceal the original message (effectively hiding it)

Explanation:

We typically apply some kind of algorithm to encrypt a message. By doing this we are effectively hiding the original contents of the message so only the people with the appropriate secret key or knowledge of the algorithm can decipher it.

ou need to implement a wireless network link between two buildings on a college campus. A wired network has already been implemented within each building. The buildings are 100 meters apart. Which type of wireless antenna should you use on each side of the link

Answers

Answer:

High-gain and directional wireless antenna.

Explanation:

WiFi can be defined as a wireless local area network that allows network devices such as access points (APs), computers (both laptops and desktops), smartphones, smart televisions, etc., to communicate with each other wirelessly over a short-ranged network. It is a standard communication network that uses radio waves to establish a channel (medium) between multiple network devices.

This ultimately implies that, the network range or distance covered by WiFi is largely dependent on transmission power and frequency. Generally, the standard range or distance covered by WiFi is about 50 meters (160 feet).

Electromagnetic waves is a propagating medium used in all communications device to transmit data (messages) from the device of the sender to the device of the receiver through the use of an antenna.

In this scenario, you need to implement a wireless network link between two buildings on a college campus, which are 100 meters apart.

A high-gain antenna is an electromagnetic device that typically has a gain rating of 12dBi or sometimes higher. Also, a highly directional antenna can only receive radio signals from a specific direction and it compresses the radio waves that are being transmitted from a sender in to a very narrow beam.

Hence, the two (2) type of wireless antenna you should use on each side of the link are a high-gain antenna and a directional wireless antenna.

Jeremiah wants to print an object from a database, and Marie wants to print a deport of her database.

Answers

Answer: both Jeremiah and Marie.

Explanation:

From the information given, while Jeremiah wants to print an object from a database, Marie wants to print a report of her database.

In this scenario, it should be noted that both Jeremiah and Marie can be able to select the information and print it since they both want to print and the action can be performed by each person.

Therefore, the correct option is B.

Angelina has added page numbers to her report, but all of the pages are labeled "Page 1” at the bottom. What caused this issue?
She typed “Page 1” in the footer.
She added a header instead of a footer.
She did not create a numbered list in her footer.
She forgot to click the Continue Numbering option.

Answers

Answer:

She typed "Page 1" in the footer.

Explanation:

This occured because the footer only repeats the same message across the footers unless you enable page numbering.

Hope this helps!

Why should a user preview the document before printing?​

Answers

The user should preview a document first to make sure the layout is correct, so as not to waste paper if a font size or layout is incorrect.

Answer:

..........

Explanation:

.................sorry i dont know

Your organization uses the following tape rotation strategy for its backup tapes: The first set of tapes is used for daily backups. At the end of each week, the latest daily backup tape is promoted to the weekly backup tape. At the end of each month, one of the weekly backup tapes is promoted to the monthly backup tape. What kind of backup tape rotation strategy is being used

Answers

Answer:

- Grandfather

Explanation:

In the given scenario, the 'grandfather backup rotation strategy' is employed to have the backup of the audiotape files. This is because the entire process is segregated into three distinct sections; daily backup that keeps the track of all the files recorded every day. It is followed by weekly storage of the audio files after the week wraps up in order to save it for future usage. Lastly, 'monthly' media is backed up in order to ensure that no data is left to be backed up that might be required later. This promotes a quicker, easier, yet complete strategy for backing up the desired data files in the systems. Hence, 'grandfather-son-rotation strategy' is the correct answer.

Which computer can be used where there is no regular electricity?​

Answers

Answer:

A mechanical computer

Explanation:

Created from gears and levers

The information included in a résumé should always relate to the job objective; if it isn’t related, it shouldn’t be included.

Answers

Answer:

True.

Explanation:

A resume (curriculum vitae) can be defined as a short text-based document that a job applicant use to briefly outline his or her qualifications, abillities and accomplishments, haven completed and obtained an academic certificate. Thus, it is used to briefly outline a person's qualifications, abillities, skills set, and accomplishments, after completing and obtaining an academic certificate such as a bachelor's degree, master's degree, etc.

Generally, all job applicants are required to have a resume (curriculum vitae). This brief and concise document is always requested by human resource managers during the job application process.

Furthermore, the primary way to make a resume persuasive (to convince or inform an action in the minds of the readers - potential employers) is by customizing it to fit each company and position.

Hence, the information included in a résumé should always relate to the job objective; if it isn’t related, it shouldn’t be included.

This ultimately implies that, job applicants are expected to tailor their resume to fit or match the position that is advertised by a company's human resources department.

The number of swappings needed to sort the number 8, 22, 7, 9, 31 in ascending order, using bubble sort is

Answers

Answer:

3

Explanation:

swap the 7 with the 22

swap the 7 with the 8

swap the 9 with the 22

Helllppppppp plzzzzzzzz

Answers

Answer:

i help you

ife ifrt ksd

its a study meeting of girls i am also girl here we only study boy were not allowed because he disturb here we only study its safe meeting of girl

Your disaster recovery plan calls for backup media to be stored at a different location. The location is a safe deposit box at the local bank. Because of this, the disaster recovery plan specifies that you choose a method that uses the least amount of backup media, but also allows you to quickly back up and restore files. Which backup strategy would BEST meet the disaster recovery plan

Answers

Answer:

Perform a full backup once per week and a differential backup the other days of the week.

An end-user license agreement protects _____.

Answers

End User License Agreements are important for protecting the rights of the business owner/licensor and critical for setting the rules of use and managing the expectations of the end-user.

Answer: both the owner and the purchaser of the software

Explanation:

which scheduling algorithm allocate the CPU firt to the process that request the CPU first, (a) first come first serve,(b) shortest job scheduling , (c) priority scheduling , (d) round robin scheduling​

Answers

Answer:

is correct answer

(a)first come first serve

Explanation:

How do you connect asp.Net mvc web application in visual studio 2013 to a database created in mysql query browser

Answers

Solution :

Asp.Net is a programming language of Microsoft. It stands for  Active Server Pages. It was developed by the giant, Microsoft which provides and helps the programmers to build a dynamic web sites, services and applications.

Using the asp.Net we can create a web application which provides interface to the existing database.

Creating an ASP.NET web application :

-- We create a new project in the Visual Studio in the same solution or the new solution and then select asp.NET web app template.

-- Name this project as ContosoSite.

-- Click OK.

-- Now in the project window of a new asp.Net project window, we select the MVC template.

-- Clear the Host in Cloud option as of now as we can deploy the application to the cloud later on.

-- Click ok for creating the application.

CLS
N = 1
FOR J = 1 TO 5
PRINT N
N = 10*N+1
NEXT J
END

Answers

Answer:

1

11

111

1111

11111

Explanation:

Given

The above QBasic code

Required

The output

The iteration on the third line is repeated 5 times; i.e. for values of j from 1 to 5.

In each iteration, the value of N is printed and the next value is calculated.

Initially, the value of N is 1 ---- on line 2

So, 1 is printed first. The next value of N is as follows:

[tex]N = 10 * N + 1[/tex] --- we keep replacing N (on the right-hand side) with current N value.

So, we have:

[tex]N = 10 * 1 + 1 =11[/tex]

[tex]N = 10 * 11 + 1 = 111[/tex]

[tex]N =10 *111+1 = 1111[/tex]

[tex]N =10 *1111+1 = 11111[/tex]

express in Qbasic assignment statement
[tex]v = \ \sqrt{t} ^{2} - 4s \div {d}^{4} [/tex]

[tex]K = {8}{x} ^{3} - {2}{y}^{ 6} \div {5}{d}+ {e}^{4} [/tex]

Answers

Answer:

v = sqr(t^(1/2)) - 4 * s / d^4

K = 8 * x^3 - 2 * y^6 / 5 * d + e^4

Explanation:

Given

[tex]v = \ \sqrt{t} ^{2} - 4s \div {d}^{4}[/tex]

[tex]K = {8}{x}^{3} - {2}{y}^{ 6} \div {5}{d}+ {e}^{4}[/tex]

Required

The equivalent in Q Basic

To solve this, we use the following rules:

+ , - and * are written as + , - and *

[tex]\div[/tex] is written as /

^ stands for raise to power

SQR is used for square

^(1/2) stands for square root.

So, the equivalents of the above statements are:

v = SQR(t^(1/2)) - 4 * s / d^4

K = 8 * x^3 - 2 * y^6 / 5 * d + e^4

Other Questions
help asap How does hyperbole best affect the meaning of this sentence from the passage?In the ashes on the hearth, side by side with my own bare footprint, was another, so vast that in comparison, mine was but an infant's!It shows that the narrator has a small child in the room with him.It indicates that the narrator believes something very large is in his room.It provides evidence that the narrator feels exhausted and is seeing things.It implies that the narrator is cold and needs to stand by the fire, but can't. Does Anybody Know The Answer? PLEASE HELP ITS TIMEDIf x/3=5/6,then x= what do you mean by society Read the argument below and determine the underlying principle that was used to come to the conclusion presented: A free college education for every citizen is important because it helps the United States create the best-educated workforce in the world. European countries like Germany are able to provide a free college education to their citizens, and the United States should as well. Which other argument uses the same underlying principle as the argument above?a. Children should get free dental care, even if they drink a lot of soda which causes cavities.b. Children should get free dental care because it will help prevent more serious issues later on and reduces future healthcare costs.c. Every child should get free dental care, even if they can afford to pay for it. Anyone help please Ill give you 20 points How many cake do you want A veterinarian asked each of her 18 patrons if they have a dog. She also asked each patron if they have acat. The Venn diagram below shows the data she collected.Complete the following two-way frequency table How did the decisions made at the Berlin Conference affect the people of Africa? 15) A new BMW decreases in value exponentially after it is purchased. If a new BMW is valued at $55,000 anddepreciate at a rate of 22% a year, what is the value after 4 years? After 8 years) Sun Smarts Solar installs solar panels in large newly constructed buildings. The company employs several expert installers who work on a full-time basis. Although the installation team works every day, the company pays them at the end of the month, for the previous month's work. Employee salaries are recorded as __________ on Sun Smarts's balance sheet.A. capital cash flows B. current liabilities C. retained earnings D. long-term liabilities A music shop sold 25 50$ radios at a profit of 8% and 6 30$ radios at a loss of 15% how much was the profit or loss combined Help! I need help with these two questions (10 points each!) The poem Drunk With The Wine Of The You are using paint to unite two focal points. How would you paint the walls in the other area.1. In a different color than in the living area2. In white to reflect the living area3. In similar color to reduce contrast4 In a lighter value than that in the living area. Write and algebraic expression:The tens digit of a number is b and the units digit is twice as big. What is the value of the number in terms of b if the digits are reversed? terms are there. Divide 51 into three parts in AP so that the largest exceeds the smallest by 10. change is the change of STTE Two stones are dropped from the edge of a 60m cliff , the second stone 1.6secon after the first . How far below the top of the cliff is the second stone when the separation between the two stone is 36m? Find the largest factor of 2520 that is not divisible by 6.