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]
2 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:
pochemuha2 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]2 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
Gtjffs
grandymaker [24]

the required documents is 3000

4 0
2 years ago
10. An engineer is designing a total hip implant. She intends to make the femoral stem out of titanium because it forms a good i
creativ13 [48]

Answer:

Yes. She should be worried about corrosion. The 18-8 stainless exhibits intergranular corrosion due to high (0.08%) carbon content and gross pitting due to low molybdenum content.

Explanation: lol

8 0
3 years ago
To solve the problem, make assumptions for missing data and justify. Given:
finlep [7]

Answer:

5,4,1, this is a explication

6 0
2 years ago
B)
Triss [41]

Answer:

2.5 is the required details

8 0
3 years ago
6) A deep underground cavern Contains 980 cuft
Elza [17]

Answer:

15625 moles of methane is present in this gas  deposit

Explanation:

As we know,

PV = nRT

P = Pressure = 230 psia = 1585.79 kPA

V = Volume = 980 cuft = 27750.5 Liters

n = number of moles

R = ideal gas constant = 8.315

T = Temperature = 150°F = 338.706 Kelvin

Substituting the given values, we get -

1585.79 kPA * 27750.5 Liters = n * 8.315 * 338.706 Kelvin

n = (1585.79*27750.5)/(8.315 * 338.706) = 15625

3 0
2 years ago
Other questions:
  • (10 points) A single crystal in the titanium cable is oriented so that the [001] direction is parallel to the applied load. If t
    14·1 answer
  • Show how am MDP with a reward function R(s, a, s’) can be transformed into a different MDP with reward function R(s, a), such th
    15·1 answer
  • Heat in the amount of 100 kJ is transferred directly from a hot reservoir at 1200 K to a cold reservoir at 600 K. Calculate the
    15·1 answer
  • Your coworker was impressed with the efficiency you showed in the previous problem and would like to apply your methods to a pro
    5·1 answer
  • Consider a metal single crystal oriented such that the normal to the slip plane and the slip direction are at angles of 43.1 deg
    6·1 answer
  • The concrete canoe team does some analysis on their design and calculates that they need a compressive strength of 860 psi. They
    15·1 answer
  • Everyone has only one learning style. True or false? hurry pleasle this exp carees class
    11·1 answer
  • A kitchen contains one section of counter that's 20 inches
    7·1 answer
  • Metal wireways are sheet metal troughs with _____________ for housing and protecting electrical conductors and cable.
    9·1 answer
  • Which alpha-numeric designator, systematically assigned at the time of manufacture, identifies the manufacturer, month, year, lo
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!