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
Which type of engineer is needed in the following scenario?
gregori [183]

Answer:

A: Agricultural Engineer

Explanation:

I had this same question for a test and got it right with a being the answer :)

8 0
3 years ago
Read 2 more answers
A fill covering a wide area is to be placed at the surface of this profile. The fill has a total unit weight of 20 kN/m^3 and is
goblinko [34]

Answer:

hello your question lacks some information attached below is the complete question with the required information

answer : 81.63 mm

Explanation:

settlement of the surface due to compression of the clay ( new consolidated )

= 81.63 mm

attached below is a detailed solution to the given problem

8 0
3 years ago
Railroad tracks made of 1025 steel are to be laid during the time of year when the temperature averages 4C (40F). Of a joint spa
DENIUS [597]

Answer:

41.5° C

Explanation:

Given data :

1025 steel

Temperature = 4°C

allowed joint space = 5.4 mm

length of rails = 11.9 m

<u>Determine the highest possible temperature </u>

coefficient of thermal expansion ( ∝ ) = 12.1 * 10^-6 /°C

Applying thermal strain ( Δl / l )  = ∝ * ΔT

                                    ( 5.4 * 10^-3 / 11.9 )  = 12.1 * 10^-6 * ( T2 - 4 )

∴  ( T2 - 4 ) =  ( 5.4 * 10^-3 / 11.9 ) / 12.1 * 10^-6

hence : T2 = 41.5°C

8 0
3 years ago
Compare the use of a low-strength, ductile material (1018 CD) in which the stress-concentration factor can be ignored to a high-
kicyunya [14]

Answer:

Step 1 of 3

Case A:

AISI 1018 CD steel,

Fillet radius at wall=0.1 in,

Diameter of bar

From table deterministic ASTM minimum tensile and yield strengths for some hot rolled and cold drawn steels for 1018 CD steel

Tensile strength

Yield strength

The cross section at A experiences maximum bending moment at wall and constant torsion throughout the length. Due to reasonably high length to diameter ratio transverse shear will be very small compared to bending and torsion.

At the critical stress elements on the top and bottom surfaces transverse shear is zero

Explanation:

See the next steps in the attached image

5 0
4 years ago
What type of bridge is the sunshine skyway bridge?
sdas [7]

Answer:

That's either a cable-stayed bridge or a cantilever bridge

6 0
3 years ago
Other questions:
  • A dielectric material, such as Teflon®, is placed between the plates of a parallel-plate capacitor without altering the structur
    10·1 answer
  • A computer has a two-level cache. Suppose that 60% of the memory references hit on the first level cache, 35% hit on the second
    12·1 answer
  • How does a car batteray NOT die?
    13·1 answer
  • Both carpenters and building inspectors have been associated with the personality characteristics identified as realistic, conve
    12·1 answer
  • How are project deliverables determined?
    14·2 answers
  • Consider five wireless stations A,B,C,D,E. Station
    5·2 answers
  • Briefly explain how each of the following influences the tensile modulus of a semicrystalline polymer and why:(a) molecular weig
    6·1 answer
  • A car air-conditioning unit has a 0.5-kg aluminum storage cylinder that is sealed with a valve, and itcontains 2 L of refrigeran
    5·1 answer
  • Today I meant to look for my missing watch, but I could never find the time.
    9·2 answers
  • A. A compound gear train is composed of four gears: E,F,G,H. Gear E has 15 teeth and is meshed with gear F. Gear F has 25 teeth
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!