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
Which one of the following types of gas is flammable? a. Neon b. Peroxide. c. Acetylene d. Carbon Dioxide ​
Delvig [45]

Answer:

D Carbon Dioxide

Explanation:

3 0
3 years ago
Read 2 more answers
A scrubber on a coal-fired power plant is useful to remove
Eddi Din [679]

Answer:

sulfur dioxide

Explanation:

The scrubber is an apparatus installed in a coal-fired power plant to clean the passing gas through the smokestack.  Due to the norm enacted through the clean air Act, almost all the scrubber used in the U.S is used to remove sulfur concentration from coal. it can remove approx 90-95% SO_2 from the smokestack.

4 0
3 years ago
Read 2 more answers
This is just so I can flip the picture
Pepsi [2]

Answer:

ok

Explanation:

thx for points

7 0
3 years ago
3. A power cycle operates between hot and cold reservoirs at 500 K and 310 K respectively. At steady state the power output deve
grin007 [14]

Answer:

0.163 MW

Explanation:

To get the minimum rate of energy rehection by heat transfer to cold reservoir, it implies that the power cycle operates in reversible cycle. The efficiency of reversible cycle whose value will be same as efficiency of power cycle will be given by

Efficiency of reversible cycle

n= (Th-Tc)/Th where T represent temperature, n efficiency, subscripts h and c hot and cold respectively

Substituting 500 and 310 for hot and cold temperatures respectively then efficiency

n=(500-310)/500=0.38

Efficiency of power cycle, n= Power output/Qh

Qh= 0.1/0.38= 0.263

Net power output, W= Qh- Qc

Qc=Qh-W= 0.263-0.1=0.163 MW

4 0
3 years ago
Quốc gia được cấu thành từ mấy yếu tố
kirill [66]
Về phương diện công pháp quốc tế thì một chủ thể được xem là quốc gia khi có đầy đủ các yếu tố sau: lãnh thổ, dân cư và có chính quyền. Quốc gia là chủ thể quan trọng của quan hệ pháp luật quốc tế.
8 0
3 years ago
Other questions:
  • A large plate is fabricated from a steel alloy that has a plane strain fracture toughness of 78 MPa (70.98 ksi). If the plate is
    7·1 answer
  • What is the correct statement regarding the stress over the section of a shaft in torsion?
    13·1 answer
  • A non-entrepreneurship, work-based, agricultural type of SAE, in which a student learns and gains skills in a paid or unpaid pos
    15·1 answer
  • Some chemical reaction is being run inside a sealed gas cylinder. During the reaction, a gaseous product is formed. The pressure
    14·1 answer
  • Disadvantage of metal
    8·1 answer
  • A 200-mm-long strip of metal is stretched in two steps, first to 300 mm and then to 400 mm. Show that the total true strain is t
    15·1 answer
  • Why is communication one of the most important aspects of an engineer’s job?
    7·2 answers
  • I really need help i will give brainly plz no funny answers
    14·1 answer
  • A college student volunteers with the elderly in a hospice program and discovers her clients complain of dry skin. She has an id
    13·2 answers
  • The toggle (t) flip-flop has one input, clk, and one output, q. on each rising edge of clk, q toggles to the complement of its p
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!