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
1) When you invest in stock, what are you doing?
statuscvo [17]

<u>Explanation:</u>

1) When we invest in stock it means we are investing in long term investment. It includes risk factor also.

2) We can make money from stocks by retaining them for a long period and selling them when their price rises.

3) dividends are paid out of distributable profits. Some companies provide dividends regularly which act as a regular source of income for investors.

4) Capital gain is the benefit obtained on selling a capital asset and if we face loss on selling the capital asset it results in capital loss. Capital assets are like stock, bonds, properties, etc.

7 0
4 years ago
Coulomb's Law Two point charges experience an attractive force of 10.8 N when they are separated by 2.4 m. VWhat force in newton
SashulF [63]

Answer:

The force between the charges when the separation decreases to 0.7 meters equals 126.955 Newtons

Explanation:

We know that for two point charges of magnitude q_{1},q_{2} the magnitude of force between them is given by

F=\frac{k_{e}q_{1}\cdot q_{2}}{r^{2}}

where

k_{e} is constant

r is the separation between the charges

Initially when the charges are separated by 2.4 meters the force can be calculated as

F_{1}=\frac{k_{e}\cdot q_{1}q_{2}}{2.4^{2}}\\\\10.8=\frac{k_{e}\cdot q_{1}q_{2}}{2.4^{2}}\\\\\therefore k_{e}\cdot q_{1}q_{2}=10.8\times 2.4^{2}=62.208

Now when the separation is reduced to 0.7 meters the force is similarly calculated as

F_{2}=\frac{k_{e}\cdot q_{1}q_{2}}{0.7^{2}}

Applying value of the constant we get

F_{1}=\frac{62.208}{0.7^{2}}

Thus F_{2}=126.955Newtons

5 0
3 years ago
An engineer who invested very well plans to retire now because she has $2,000,000 in her ORP account. How long will she be able
Ede4ka [16]

Answer:

20 years

Explanation:

You do 2,000,000 ÷ 100,000 but you can simplify that to 20 ÷ 1 = 20

During those 20 years, the profits you earn will be 80,000 since when you do 2,000,000 x 0.04 but you can simplify that to 20,000 x 4 getting 80,000 and that quite doesn't reach 100,000 dollars

8 0
3 years ago
Place these events in chronological order. Put the numbers 1-6 next to the<br> events.
VikaD [51]
The order should be:

3, 5, 1, 4, 2, 6

3 0
3 years ago
Would you rather be fishing or hunting?
katen-ka-za [31]

Answer:

probs fishing

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • What is advantage and disadvantage of flat top sampling in digital signal trasmission?​
    9·1 answer
  • Which of the following does NOT describe product design.
    11·1 answer
  • Determine the angle φ at which the applied force P should act on the pipe so that the magnitude of P is as small as possible for
    13·1 answer
  • 4. A person is standing 4 miles east from his house. He travels 2 miles east. a. Calculate the initial displacement. b. Calculat
    13·1 answer
  • Find the percent change in cutting speed required to give an 80% reduction in tool life when the value of n is 0.12.
    13·1 answer
  • A specimen of a 4340 steel alloy with a plane strain fracture toughness of 54.8 MPa (50 ksi ) is exposed to a stress of 2023 MPa
    14·1 answer
  • If a signal is transmitted at a power of 250 mWatts (mW) and the noise in the channel is 10 uWatts (uW), if the signal BW is 20M
    13·1 answer
  • Consider that a system has two entities, Students, Instructors and Course. The Student has the following properties: student nam
    12·1 answer
  • For heat transfer purposes, a standing man can be mod-eled as a 30-cm-diameter, 170-cm-long vertical cylinderwith both the top a
    11·1 answer
  • Find the magnitude of the two pulling forces P and Q when their resultant is 50 N at 20° with Q. P 20°​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!