answer.
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]
2 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:
pochemuha2 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]2 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 advantage of decreasing the field current of a separately excited dc motor below its nominal value
enyata [817]

Answer:

Ability to rotate at higher speeds

Explanation:

Constant K1 becomes greater than the other constant K2

This translates to that the motor being able to rotate at high speeds, without necessarily exceeding the nominal armature voltage.

The armature voltage is the voltage that is developed around the terminals of the armature winding of an Alternating Current, i.e AC or a Direct Current, i.e DC machine during the period in which it tries to generate power.

6 0
2 years ago
A center-point bending test was performed on a 2 in. x d in. wood lumber according to ASTM D198 procedure with a span of 4 ft an
Zigmanuir [339]

Answer:

3.03 INCHES

Explanation:

According to ASTM D198 ;

Modulus of rupture = ( M / I ) * y  ----- ( 1 )

M ( bending moment ) = R * length of span / 2

                                     = (120 * 10^3 ) * 48 / 2 = 288 * 10^4 Ib-in

I ( moment of inertia ) = bd^3 / 12

                                    = ( 2 )*( d )^3  / 12 =  2d^3 / 12

b = 2 in ,  d = ?

length of span = 4 * 12 = 48 inches

R = P  / 2 =  240 * 10^3 / 2 =   120 * 10^3 Ib

y ( centroid distance ) = d / 2  inches

back to equation ( 1 )

( M / I ) * y

940.3 ksi = ( 288 * 10^4 / 2d^3 / 12 ) * d / 2

                = ( 288 * 10^4 * 12 ) / 2d^3 )  * d / 2

940300  = 34560000* d / 4d^3

4d^3 ( 940300 ) = 34560000 d  ( divide both sides with d )

4d^2 = 34560000 / 940300

d^2 = 9.188   ∴ Value of d ≈ 3.03 in

8 0
2 years ago
In which of the following branches of engineering is the practice not restricted?
fgiga [73]

Answer:

a) civil engineering.

Explanation:

Civil engineering is a professional engineering program that deals with the construction, design, and maintenance of all the natural and man-made environments including dams, buildings, railways, and roads.

Civil engineering is the branch of engineering that is the practice not restricted because civil engineer is not restricted to academic profession but practice in designing and construction can make someone a professional civil engineer.

Hence, the correct answer is "a)."

6 0
2 years ago
Read 2 more answers
Water is flowing in a metal pipe. The pipe OD (outside diameter) is 61 cm. The pipe length is 120 m. The pipe wall thickness is
Yuki888 [10]

Answer:

1113kN

Explanation:

The ouside diameter OD of the pipe is 61cm and the thickness T is 0.9cm, so the inside diameter ID will be:

Inside Diameter = Outside Diameter - Thickness

Inside Diameter = 61cm - 0.9cm = 60.1cm

Converting this diameter to meters, we have:

60.1cm*\frac{1m}{100cm}=0.601m

This inside diameter is useful to calculate the volume V of water inside the pipe, that is the volume of a cylinder:

V_{water}=\pi  r^{2}h

V_{water}=\pi (\frac{0.601m}{2})^{2}*120m

V_{water}=113.28m^{3}

The problem gives you the water density d as 1.0kg/L, but we need to convert it to proper units, so:

d_{water}=1.0\frac{Kg}{L}*\frac{1L}{1000cm^{3}}*(\frac{100cm}{1m})^{3}

d_{water}=1000\frac{Kg}{m^{3}}

Now, water density is given by the equation d=\frac{m}{V}, where m is the water mass and V is the water volume. Solving the equation for water mass and replacing the values we have:

m_{water}=d_{water}.V_{water}

m_{water}=1000\frac{Kg}{mx^{3}}*113.28m^{3}

m_{water}=113280Kg

With the water mass we can find the weight of water:

w_{water}=m_{water} *g

w_{water}=113280kg*9.8\frac{m}{s^{2}}

w_{water}=1110144N

Finally we find the total weight add up the weight of the water and the weight of the pipe,so:

w_{total}=w_{water}+w_{pipe}

w_{total}=1110144N+2500N

w_{total}=1112644N

Converting this total weight to kN, we have:

1112644N*\frac{0.001kN}{1N}=1113kN

7 0
2 years ago
Oliver is designing a new children’s slide to increase the speed at which a child can descend. His first design involved steel b
AVprozaik [17]

Answer:

The correct option is;

A) Steel becomes too hot in the Sun and can burn the children

Explanation:

The properties of steel includes;

Low specific heat capacity, high thermal and electrical toughness, high hardness, high tensile strength, high yield strength, appreciable elongation, high fatigue strength, can easily corrode, high malleability and ability to creep

Therefore, due to the low specific heat capacity, which is 0.511 J/(g·°C) and high conductivity of steel which is about 32 W/(m·k), the temperature of the steel can rapidly rise and the hot steel surface can readily conduct the heat, (due to the temperature difference) to other bodies that come in contact

8 0
2 years ago
Other questions:
  • Consider a plane composite wall that is composed of two materials of thermal conductivities kA 0.1 W/mK and kB 0.04 W/mK and thi
    14·1 answer
  • 3. (20 points) Suppose we wish to search a linked list of length n, where each element contains a key k along with a hash value
    7·1 answer
  • What can your employer do to protect you from overhead power lines?
    8·1 answer
  • The rigid bar CDE is attached to a pin support at E and rests on the 30 mm diameter brass cylinder BD. A 22 mm diameter steel ro
    8·1 answer
  • Universal Containers (UC) has a requirement to expose a web service to their business partners. The web service will be used to
    10·1 answer
  • If the current on your power supply exceeds 500 mA it can damage the supply. Suppose the supply is set for 37 V. What is the sma
    9·1 answer
  • Two AISI 304 stainless steel plates 10 mm thick are subjected to a contact pressure of 1 bar under vacuum conditions for which t
    9·1 answer
  • Suggest how any sorting algorithm can be augmented in a way to make the best-case count of its key comparisons equal to just n−1
    6·1 answer
  • The in situ moist unit weight of a soil is 17.3 kN/m3 and the moisture content is 16%. The specific gravity of soil solids is 2.
    12·1 answer
  • Why is it so dangerous to use a ground lift on a metal cased power tool
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!