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
Maggie discovered that a pipe in her basement has sprung a leak. She calls a plumber but in the meantime she grabs a roll of duc
dem82 [27]

Answer:

The answer is "Option a".

Explanation:

Myelination was the myelinization mechanism of a neuron axon. The endothelium is enveloped all around the axon and isolates the axon that inhibits the neuronal message from leaking with the other neuronal axons. Inside this example, therefore, its tubes tape worked similarly to those of myelin sheath, which stops brain transmission.

3 0
3 years ago
Why do wires hang loosely during summer?
Stella [2.4K]

Answer:

due to the expansion process and they contract during winter due to the contraction process. Explanation: Electric cables are the solids which exhibit the property of contraction and expansion.

6 0
3 years ago
A cylinder fitted with a frictionless piston contains 2 kg of R-134a at 3.5 bar and 100 C. The cylinder is now cooled so that th
inna [77]

Answer:

The answer to the question is

The heat transferred in the process is -274.645 kJ

Explanation:

To solve the question, we list out the variables thus

R-134a = Tetrafluoroethane

Intitial Temperaturte t₁ = 100 °C

Initial pressure = 3.5 bar = 350 kPa

For closed system we have m₁ = m₂ = m

ΔU = m×(u₂ - u₁) = ₁Q₂ -₁W₂

For constant pressure process we have

Work done = W = \int\limits^a_b P \, dV  = P×ΔV = P × (V₂ - V₁) = P×m×(v₂ - v₁)

From the tables we have

State 1 we have h₁ = (490.48 +489.52)/2 = 490 kJ/kg

State 2 gives h₂ = 206.75 + 0.75 × 194.57= 352.6775 kJ/kg

Therefore Q₁₂ = m×(u₂ - u₁) + W₁₂ = m × (u₂ - u₁) + P×m×(v₂ - v₁)

= m×(h₂ - h₁) = 2.0 kg × (352.6775 kJ/kg - 490 kJ/kg) =-274.645 kJ

5 0
3 years ago
A) Total Resistance<br> b) Total Current<br> c) Current and Voltage through each resistor
Varvara68 [4.7K]
C my friend 20 characters suck
3 0
3 years ago
Bessy's calf weighed 99.19 pounds when calved on March 7th. Her calf gained an average of 1.85 pounds per day for 266 days. What
Zepler [3.9K]

Answer:

591.3

Explanation:

99.19 + (1.85 × 266) = 591.29

rounded = 591.3

4 0
3 years ago
Other questions:
  • Write a C++ program to display yearly calendar. You need to use the array defined below in your program. // the first number is
    13·1 answer
  • True/False
    15·1 answer
  • Consider tests of an unswept wing that spans the wind tunnel and whose airfoil section is NACA 23012. Since the wing model spans
    13·1 answer
  • Calculate and plot the radial and circumferential stress distribution in the left ventricle at the end of systole (p 5 80 mmHg;
    13·1 answer
  • For the Mohr's circle of a plane-strain element, which of the following changes as a result of shear strain change?
    7·1 answer
  • How much memory can a 32 -bit processor support ?
    13·1 answer
  • Refrigerant-134a enters the expansion valve of a refrigeration system at 120 psia as a saturated liquid and leaves at 20 psia. D
    15·1 answer
  • Two ball bearings from different manufacturers are being considered for a certain application. Bearing A has a catalog rating of
    10·1 answer
  • What subject is he......... now? Vietnamese.A. to learnB. learnC. learningD. learned
    10·1 answer
  • which of the following statements are true about client-side DNS? (Choose all that apply). a. If an APIPA address is assigned, t
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!