1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
myrzilka [38]
3 years ago
11

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) (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)
Engineering
2 answers:
pochemuha3 years ago
8 0

Answer:

import java.util.Scanner;

  public class PeopleWeights {

    public static void main(String[] args) {

    Scanner reader = new Scanner(System.in);  

    double weightOne = reader.nextDouble();

    System.out.println("Enter 1st weight:");

    double weightTwo = reader.nextDouble();

    System.out.println("Enter 2nd weight :");

    double weightThree = reader.nextDouble();

    System.out.println("Enter 3rd weight :");

    double weightFour = reader.nextDouble();

    System.out.println("Enter 4th weight :");

    double weightFive = reader.nextDouble();

    System.out.println("Enter 5th weight :");

     double sum = weightOne + weightTwo + weightThree + weightFour + weightFive;

     double[] MyArr = new double[5];

     MyArr[0] = weightOne;

     MyArr[1] = weightTwo;

     MyArr[2] = weightThree;

     MyArr[3] = weightFour;

     MyArr[4] = weightFive;

     System.out.printf("You entered: " + "%.1f %.1f %.1f %.1f %.1f ", weightOne, weightTwo, weightThree, weightFour, weightFive);

     double average = sum / 5;

     System.out.println();

     System.out.println();

     System.out.println("Total weight: " + sum);

     System.out.println("Average weight: " + average);

     double max = MyArr[0];

     for (int counter = 1; counter < MyArr.length; counter++){

        if (MyArr[counter] > max){

           max = MyArr[counter];

        }

     }

     System.out.println("Max weight: " + max);

  }

import java.util.Scanner;

  public class PeopleWeights {

    public static void main(String[] args) {

    Scanner reader = new Scanner(System.in);  

    double weightOne = reader.nextDouble();

    System.out.println("Enter 1st weight:");

    double weightTwo = reader.nextDouble();

    System.out.println("Enter 2nd weight :");

    double weightThree = reader.nextDouble();

    System.out.println("Enter 3rd weight :");

    double weightFour = reader.nextDouble();

    System.out.println("Enter 4th weight :");

    double weightFive = reader.nextDouble();

    System.out.println("Enter 5th weight :");

     double sum = weightOne + weightTwo + weightThree + weightFour + weightFive;

     double[] MyArr = new double[5];

     MyArr[0] = weightOne;

     MyArr[1] = weightTwo;

     MyArr[2] = weightThree;

     MyArr[3] = weightFour;

     MyArr[4] = weightFive;

     System.out.printf("You entered: " + "%.1f %.1f %.1f %.1f %.1f ", weightOne, weightTwo, weightThree, weightFour, weightFive);

     double average = sum / 5;

     System.out.println();

     System.out.println();

     System.out.println("Total weight: " + sum);

     System.out.println("Average weight: " + average);

     double max = MyArr[0];

     for (int counter = 1; counter < MyArr.length; counter++){

        if (MyArr[counter] > max){

           max = MyArr[counter];

        }

     }

     System.out.println("Max weight: " + max);

  }

Morgarella [4.7K]3 years ago
5 0

Answer:

The source code file to this question has been attached to this response. Please download it and go through it. The file contains comments explaining significant sections of the code. Please go through the comments in the code.

Download java
You might be interested in
Why do computers use 1 and 0
tangare [24]

I like ya cut g

Explanation:

bonK no Uhm

6 0
3 years ago
Read 2 more answers
The flowrate through a rectangular channel is 20 cfs. The upstream width of the channel is 10 ft, and the depth of the water in
Liula [17]

To solve this problem we will use the Froude number that relates the Forces of Inertia with the Forces of Gravity. There will be jump in the downstream only if Froude Number (Fr) is greater than 1 at upstream. Our values are given as,

Q = 20cfs\\w= 10ft\\D= 1ft

Then the velocity would be:

V = \frac{Q}{wD}V = \frac{20}{10*1}V = 2ft/s

The number of Froude is given as,

Fr = \frac{V}{gD}^{1/2}

Where,

V = Velocity

g = Gravity

D = Diameter

Replacing we have that

Fr = \frac{2}{32.2}^{1/2}\\Fr = 0.352\\Fr

There will be no Jump, correct answer is B.

5 0
3 years ago
2. Describe the three phases of the life cycle curve Draw the curve and label it in detail (the
miskamm [114]
57665554455555555rrtttyyyyuuiyt
5 0
3 years ago
4 grams of a saturated liquid are converted to a saturated vapor by being heated in a weighted piston–cylinder device arranged t
antiseptic1488 [7]

Answer:T2= 351.6k

Explanation:

6 0
3 years ago
What is 90 to the power of 46
Mnenie [13.5K]

Answer:Just multiply 90 by itself 46 times

Explanation:

do it

6 0
4 years ago
Other questions:
  • The components of an electronic system dissipating 90 W are located in a 1-m-long circular horizontal duct of 15-cm diameter. Th
    11·1 answer
  • Which of the following about top-down design is true?
    14·1 answer
  • A person puts a few apples into the freezer at -15oC to cool them quickly for guests who are about to arrive. Initially, the app
    15·1 answer
  • In a reversible process both the system and surrondings can be returned to their initial states. a)-True b)-False
    14·1 answer
  • As the impurity concentration in solid solution of a metal is increased, the tensile strength:________.a) decreasesb) increasesc
    9·1 answer
  • Three forces are applied to a short steel post as shown. Determine the principle stresses, principal planes (rotation angle), an
    9·1 answer
  • Write a program that asks the user to input a vector of integers of arbitrary length. Then, using a for-end loop the program exa
    13·1 answer
  • 1. When measuring a cylinder for wear, the most wear will be found at the
    6·1 answer
  • Método de Programación lineal utilizado para resolver problemas en teoría de redes?
    15·1 answer
  • Click this link to view O*NET’s Work Context section for Loading Machine Operators. Note that common contexts are listed toward
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!