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
Write down the types and tasks of the pressure control valves ?
Yuki888 [10]

Answer:

There are 6 types of pressure control valves and their function is to regulate the pressure below a threshold level within safe limits and to maintain and control  pressure of a particular circuit.

Explanation:

The six type of Pressure valve with their functions are given below:

a. Unloading Valve:

These type of pressure valve are used to pour fluid into the container at very low or no pressure.

b. Safety valve:

These are used when the pressure within the vessel is in excess as inside temperature is near about preset [point point then these valves are open to release the extra pressure and are closed once normal conditions are regained.

c. Pressure Reducing Valve:

These are basically used for the control of the pressure in downstream not exceeding the design limits.

d. Pressure Relief Valves:

These are basically used to limit and regulate the pressure of any system.

e. Counter Balance Valve:

These are used to develop pressure in the reverse direction at the actuator's return line in order to keep the load under control.

f. Sequence Valve:

These are used to maintain sequence or order in the operations of two parts or branches.

8 0
3 years ago
It is said that Archimedes discovered his principle during a bath while thinking about how he could determine if KingHiero‘s cro
Rudiy27

Answer:

the crown is false densty= 12556kg/m^3[/tex]

Explanation:

Hello! The first step to solve this problem is to find the mass of the crown, this is found using the weight of the crown in the air by means of the equation for the weight.

W=mg

W=weight(N)=31.4N

M=Mass

g=gravity=9.81m/S^2

solving for M

m=W/g

m=\frac{31.4N}{9.81m/S^2}=3.2kg

The second step is find the volume of crown  remembering that when an object is weighed in the water the result is the subtraction between the weight of the object and the buoyant force of the water which is the product of the volume of the crown by gravity by density of water

F=mg-\alpha  V g

Where

F=weight in water=28.9N

m=mass of crown=3.2kg

g=gravity=9.81m/S^2

α=density of water=1000kg/m^3

V= crown´s volume

solving for V

V=\frac{mg-F }{g \alpha } =\frac{(3.2)(9.81)-28.9}{9.81(1000)} =0.000254m^3

finally, we remember that the density is equal to the index between mass and volume

\alpha =\frac{m}{v} =\frac{3.2}{0.000254} =12556kg/m^3

To determine the density of the crown without using the weight in the water and with a bucket we can use the following steps.

1.weigh the crown in the air and find the mass

2. put water in a cylindrical bucket and measure its height with a ruler.

3. Put the crown in the bucket and measure the new water level with a ruler.

4. Subtract the heights, and find the volume of a cylinder knowing the difference in heights and the diameter of the bucket, in order to determine the volume of the crown.

5. find density by dividing mass by volume

7 0
3 years ago
Water from the Earth's surface turns into a gas, or water vapor, when it is warmed and
bagirrra123 [75]

Answer:

Evaporation.

Explanation:

Evaporation is the stage of the Water Cycle where water turns into water vapor. The steps following Evaporation in order include Condensation, Precipitation, and Transpiration.

4 0
4 years ago
Read 2 more answers
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
The settlement of foundations is typically the result of three separate occurrences that take place in the soil which provides s
evablogger [386]

Answer:

The differences are listed below

Explanation:

The differences between consolidation and compaction are as follows:

In compaction the mechanical pressure is used to compress the soil. In consolidation, there is an application of stead pressure.

In compaction, there is a dynamic load by rapid mechanical methods like tamping, rolling, etc. In consolidation, there is static and sustained pressure applied for a long time.

In compaction, the soil volume is reduced by removing air from the void. In consolidation, the soil volume is reduced by squeezing out water from the pores.

Compaction is used for sandy soil, consolidation on the other hand, is used for clay soil.

7 0
3 years ago
Read 2 more answers
Other questions:
  • 5. Switch a in the circuit has been open for a long time and switch b has been closed for a long time. Switch a is closed at t =
    13·1 answer
  • A common rule of thumb for controller discretization is to have "6 samples per rise time" in order to achieve a reasonable appro
    9·1 answer
  • A single-phase inductive load draws a 10 MW at 0.6 power factor lagging. Calculate the reactive power of a capacitor to be conne
    14·1 answer
  • Consider a section of muscle tissue of a cylindrical shape with a radius of 1.5 cm. During highly rigorous exercise, metabolic p
    8·1 answer
  • A reversible refrigeration cycle operates between cold and hot reservoirs at temperatures TC and TH, respectively. (a) If the co
    6·1 answer
  • An automobile engine consumes fuel at a rate of 22 L/h and delivers 85 kW of power to the wheels. If the fuel has a heating valu
    8·2 answers
  • An automobile having a mass of 1100 kg initially moves along a level highway at 110 km/h relative to the highway. It then climbs
    7·1 answer
  • Most goals
    12·1 answer
  • In surveying , supposing we can not pull the tape because it is passing through a shallow river. What will i do to obtain an acc
    11·1 answer
  • If a bearing needs 4. 0 s to solidify enough for impact, how high must the tower be?.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!