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
Regeneration can only increase the efficiency of a Brayton cycle when working fluid leaving the turbine is hotter than the worki
storchak [24]

Answer:

True, <em>Regeneration is the only process where increases the efficiency of a Brayton cycle when working fluid leaving the turbine is hotter than working fluid leaving the compressor</em>.

Option: A

<u>Explanation: </u>

To increase the efficiency of brayton cycle there are three ways which includes inter-cooling, reheating and regeneration. <em>Regeneration</em> technique <em>is used when a turbine exhaust fluids have higher temperature than the working fluid leaving the compressor of the turbine. </em>

<em>Thermal efficiency</em> of a turbine is increased as <em>the exhaust fluid having higher temperatures are used in heat exchanger where the fluids from the compressor enters and increases the temperature of the fluids leaving the compressor. </em>

6 0
3 years ago
Read 2 more answers
When passing another vehicle, when is it acceptable to drive over the
miss Akunina [59]

Answer:

Under no circumstances

Explanation:

I'm not 100% sure why, but I remember hearing that you're not suposed to go over the speed limit no matter what

7 0
3 years ago
Read 2 more answers
To find the quotient of 8 divided by 1/3, multiply 8 by?
iVinArrow [24]

Answer: 8.33333333 or 6.1989778

Explanation:

8 0
2 years ago
A water reservoir contains 108 metric tons of water at an average elevation of 84 m. The maximum amount of electric energy that
zavuch27 [327]

Answer:

24.72 kwh

Explanation:

Electric energy=potential energy=mgz where m is mass, g is acceleration due to gravity and z is the elevation.

Substituting the given values while taking g as 9.81 and dividing by 3600 to convert to per hour we obtain

PE=(108*9.81*84)/3600=24.72 kWh

8 0
4 years ago
 what can be done to prevent bridges from collapsing? ( give at least two examples)
ryzh [129]

Explanation:

the owner of the bridge and some workers

4 0
2 years ago
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
  • Define, in words the following i relative humidity ii) dew point temperature
    7·1 answer
  • How is air pressure affected by the shape of an aircraft wing
    14·1 answer
  • In c the square root of a number N can be approximated by repeated calculation using the formula NG = 0.5(LG + N/LG) where NG st
    14·1 answer
  • In a creep test, increasing the temperature will (choose the best answer) A. increase the instantaneous initial deformation B. i
    5·1 answer
  • I don't know what is this​
    9·1 answer
  • Can somebody help me with that
    13·1 answer
  • ما سبب نزول الاية
    6·1 answer
  • Which of the following is NOT associated with Urban Sprawl?
    8·1 answer
  • Which traits are common in all four career pathways of the Information Technology field? Check all that apply.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!