subject
Computers and Technology, 03.08.2021 02:40 tankddd

1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the array's numbers on one line, each number followed by one space. (2 pts) Ex:
Enter weight 1: 236
Enter weight 2: 89.5
Enter weight 3: 142
Enter weight 4: 166.3
Enter weight 5: 93
You entered: 236.0 89.5 142.0 166.3 93.0
(2) Also output the total weight, by summing the array's elements. (1 pt)
(3) Also output the average of the array's elements. (1 pt)
(4) Also output the max array element. (2 pts)
Ex:
Enter weight 1: 236
Enter weight 2: 89.5
Enter weight 3: 142
Enter weight 4: 166.3
Enter weight 5: 93
You entered: 236.0 89.5 142.0 166.3 93.0
Total weight: 726.8
Average weight: 145.35999999999999
Max weight: 236.0

I attempted this but kept getting errors:
import java. util. Scanner;
public class PeopleWeights{
public static void main(String[] args) {
Scanner input = new Scanner(System. in);
int SIZE = 5;
double[] array = new double[5];
// read 5 inputs from user
for (int i = 0; i < SIZE; i++) {
System. out. print("Enter weight ");
array[i] = input. nextDouble();
}
// display the data
System. out. print("You entered: ");
for (int i = 0; i < SIZE; i++) {
System. out. print(array[i] + " ");
}
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:00
In a file-oriented information system, a work file stores relatively permanent data about an entity is created and saved for backup and recovery purposes stores records that contain day-to-day business and operational data is a temporary file created by an information system for a single task
Answers: 1
question
Computers and Technology, 22.06.2019 12:10
1. declare a constant named cents_per_pound and initialize with 25. 2. get the shipping weight from user input storing the weight into shipweightpounds. 3. using flat_fee_cents and cents_per_pound constants, assign shipcostcents with the cost of shipping a package weighing shipweightpounds.
Answers: 2
question
Computers and Technology, 22.06.2019 16:20
Consider the following statements, then select one of the answers below: the signal() function shown below registers "sig_handler()" as the signal handler function for the sigkill signal, without the complexity of using when the sigkill signal is sent to a process running this code, by a user typing "kill -kill ", where the correct process id is used for to target the process, sig_handler() will be executed.
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
The graph shows median weekly earnings for full-time workers according to education level. which can you not conclude?
Answers: 2
You know the right answer?
1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array...
Questions
question
Geography, 06.02.2021 03:10
question
Mathematics, 06.02.2021 03:10
question
Mathematics, 06.02.2021 03:10
question
Mathematics, 06.02.2021 03:10
question
Mathematics, 06.02.2021 03:10
question
Mathematics, 06.02.2021 03:10
question
Mathematics, 06.02.2021 03:10
question
Mathematics, 06.02.2021 03:10
question
Mathematics, 06.02.2021 03:10