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
What is the magnitude of the maximum stress that exists at the tip of an internal crack having a radius of curvature of 3 × 10-4
Vladimir [108]

Answer:

maximum stress is 2872.28 MPa

Explanation:

given data

radius of curvature = 3 × 10^{-4} mm

crack length = 5.5 × 10^{-2} mm

tensile stress = 150 MPa

to find out

maximum stress

solution

we know that  maximum stress formula that is express as

\sigma m = 2 ( \sigma o ) \sqrt{\frac{a}{\delta t}}     ......................1

here σo is applied stress and a is half of internal crack and t is radius of curvature of tip of internal crack

so put here all value in equation 1 we get

\sigma m = 2 ( \sigma o) \sqrt{\frac{a}{\delta t}}  

\sigma m = 2(150) \sqrt{ \frac{\frac{5.5*10^{-2}}{2}}{3*10^{-4}}}  

σm = 2872.28 MPa

so maximum stress is 2872.28 MPa

8 0
3 years ago
Need some help with these plz
pashok25 [27]

100: D, third law of motion

101: D, second law of motion

5 0
3 years ago
Type the correct answer in the box. Spell all words correctly.
Rudik [331]

Answer:ii dant overstand

Explanation:

5 0
3 years ago
Given resistance 30ohms Inductance 200mH is connected to a 230v,50hZ supply. Impedance 69.6ohms Calculate current consumed?
Kisachek [45]

Answer:

the current consumed is 3.3 A

Explanation:

Given;

resistance, R = 30 ohms

inductance, L = 200 mH

Voltage supply, V = 230 V

frequency of the coil, f = 50 Hz

impedance, Z = 69.6 Ohms

The current consumed is calculated as;

I = \frac{V}{Z} \\\\I = \frac{230}{69.6} \\\\I = 3.3 \ A

Therefore, the current consumed is 3.3 A

4 0
3 years ago
X-Ray Inspection
Softa [21]
The answer is the test is being tested towards the lungs the test is done by scanning your body the tools are called “the x rat visional lock space” and the rubber tool is called a deeldo it’s purple with a pencil looking shape perfect for the body.
5 0
3 years ago
Other questions:
  • Zona intermedia de pozos <br> Y<br> Efecto de inavasion
    6·1 answer
  • Una empresa realizó en el ejercicio de compras al contado por valor
    9·1 answer
  • Identify which sound type each line contains.
    10·1 answer
  • The input power for a thermostat is wired to the
    8·1 answer
  • Chemical manufacturers must present which information on the product's label?
    5·1 answer
  • Create an abstract class DiscountPolicy. It should have a single abstract method computeDiscount that will return the discount f
    7·1 answer
  • Prove the following languages are nonregular, once using the pumping lemma and once using the Myhill-Nerode theorem. When using
    15·1 answer
  • A magnesium oxide component must not fail when a tensile stress of 14 MPa is applied. Determine the maximum allowable surface cr
    8·1 answer
  • Which of these are an ethical issue
    14·1 answer
  • Tech A says that coolant circulates through some intake manifolds to help warm them up. Tech B says that some intake manifolds u
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!