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
The enforcement of OSHA standards is provided by federal and state
Gnoma [55]

Answer:

Explanation:

Enforcing OSHA, Occupational Safety and Health Administration, standards is not a job for electricians, lawmakers or tax collectors. The right answer is safety inspectors.

3 0
2 years ago
In a certain chemical plant, a closed tank contains ethyl alcohol to a depth of 71 ft. Air at a pressure of 17 psi fills the gap
Yuliya22 [10]

Answer:

the pressure at a closed valve attached to the tank 10 ft above its bottom is 37.88 psi

Explanation:

Given that;

depth 1 = 71 ft

depth 2 = 10 ft

pressure p = 17 psi = 2448 lb/ft²

depth h = 71 ft - 10 ft = 61 ft

we know that;

p = P_air + yh

where y is the specific weight of ethyl alcohol ( 49.3 lb/ft³ )

so we substitute;

p = 2448 + ( 49.3 × 61 )

= 2448 + 3007.3

= 5455.3 lb/ft³

= 37.88 psi

Therefore, the pressure at a closed valve attached to the tank 10 ft above its bottom is 37.88 psi

5 0
3 years ago
1. When the pneumatic device was demonstrated, explain something that was different than what you expected.
Vera_Pavlovna [14]

Answer:

1. Effect of air pressure

2. air- powered wheel chair

3. Pneumatic valves

Explanation:

1. In any pneumatic device, the mipact of air pressure to produce the moving effect on an heavy object is unexpected.

2. pneumatice demultiplexer when air in comprressed tank is allowed released to cause movement of the  chair.

3. In industries, a pneumatic valve operates by force of air when actuated. A signal causes actuation of coil. When coil is energized, compressed high pressure air is allowe to enter in a small cylinder and cause operation of valve

5 0
3 years ago
Read 2 more answers
A circular bar will be subjected to an axial force (P) of 2000 lbf. The bar will be made of material that has a strength (S) of
schepotkina [342]

Answer:

n = 2.36

Explanation:

The stress experimented by the circular bar is:

\sigma = \left[\frac{2000\, lbf}{\frac{\pi}{4}\cdot (0.5\,in)^{2}}\right]\cdot \left(\frac{1\,kpsi}{1000\,psi} \right)

\sigma = 10.186\,kpsi

The safety factor is:

n = \frac{24\,kpsi}{10.186\,kpsi}

n = 2.36

5 0
3 years ago
What is christmas really about
Ray Of Light [21]

Answer:

Christmas is celebrated to remember the birth of Jesus Christ, who Christians believe is the Son of God.

Explanation:

Christmas is celebrated to remember the birth of Jesus Christ, who Christians believe is the Son of God. The name 'Christmas' comes from the Mass of Christ (or Jesus). A Mass service (which is sometimes called Communion or Eucharist) is where Christians remember that Jesus died for us and then came back to life.

5 0
3 years ago
Read 2 more answers
Other questions:
  • A meter stick can be read to the nearest millimeter and a travelling microscope can be read to the nearest 0.1 mm. Suppose you w
    11·1 answer
  • Where Does a Solar Engineer Work? <br> (2 sentences or more please)
    14·2 answers
  • How many grams of perchloric acid, HClO4, are contained in 37.6 g of 70.5 wt% aqueous perchloric acid? How many grams of water a
    10·1 answer
  • By efficiency, we generally mean the ratio of the desired output to the required input. That is, efficiency is a measure of what
    7·1 answer
  • Technician A says that reversing the direction of refrigerant (as with a heat pump system) could be done to provide cabin heat.
    14·1 answer
  • What are the nominal dimensions for a 1x2 stick of lumber, a 2x4 stick of lumber and a standard sheet of plywood?
    11·1 answer
  • PLEASE HELP!<br> I'm in the middle of a test and the teacher didn't go over the material!
    10·1 answer
  • HELP ASSAPPP
    15·1 answer
  • The metric ruler is typically divided into
    6·2 answers
  • Question 2
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!