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 following median grain size data were obtained during isothermal liquid phase sintering of an 82W-8Mo-8Ni-2Fe alloy. What is
Morgarella [4.7K]

Answer:

The probable grain-coarsening mechanism is : Ideal grain growth mechanism

( d^{2}- d_{0} ^{2} = kt )

Explanation:

The plot attached below shows the time dependence of the growth of grain.

The probable grain-coarsening mechanism is : Ideal grain growth mechanism

the ideal growth follows this principle = d^{2} - d^{2} _{0}  = kt

d = final grain size

d_{0} = initial grain size

k = constant ( temperature dependent )

t = 0

8 0
4 years ago
Pleaseeee help me with this!!
lilavasa [31]
Can you add a picture??
3 0
3 years ago
Statement 1: All balls hit the ground at the same time. Statement 2: All balls hit the ground with the same force. Statement 3:
laiz [17]

Answer:

Statement 1: All balls hit the ground at the same time

Explanation:

When there is no resistance of air, the acceleration due to gravity experienced by all the bodies are same. So for falling bodies, neglecting the air resistance, the falling object will be weightless and therefore all the objects will hit the ground at the same time when there is nor air resistance and the objects are considered to be falling in vacuum.

7 0
3 years ago
Examine the pressure-measuring device shown in the figure below. (a) What is the gauge pressure reading in psi at point A? (b) W
Hunter-Best [27]

Answer: 45

Explanation:just cuase I need to

4 0
3 years ago
What kind of microscope would be used to study a whole or opaque object?
djyliett [7]

Answer:

the compound light microscope

Explanation:

The stereomicroscope is to study section to study the entire objects in three dimensions at low magnification. A Compound light microscope is used for small or thinly sliced objects under higher magnification than stereomicroscope.

4 0
4 years ago
Other questions:
  • OSHA does not approve individual states to have their own safety and health program.
    15·2 answers
  • Koch traded Machine 1 for Machine 2 when the fair market value of both machines was $60,000. Koch originally purchased Machine 1
    10·1 answer
  • An escalator with 35° incline is designed to have two passengers per step. Find number of persons moved per hour for the design
    13·1 answer
  • RKI Instruments borrowed $4,800,000 from a private equity firm for expansion of its facility for manufacturing carbon monoxide m
    11·1 answer
  • While out on the International Space Station, an engineer was able to gather a sample of a new type of unidentified rock. What k
    12·2 answers
  • An intersection had 13 crashes last year. The 4 legs of the intersection had 2-way ADT values of 9671, 2893, 9506, and 2611 vehi
    12·1 answer
  • (25%) A well-insulated compressor operating at steady state takes in air at 70 oF and 15 psi, with a volumetric flow rate of 500
    12·1 answer
  • Determine the 0.25 hour synthetic unit hydrograph for a watershed of the following characteristics:
    12·1 answer
  • Why exam is important in our life
    14·2 answers
  • Which type of astm c150 standard portland cement is best suited for a concrete where minimal total heat evolution and minimal ra
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!