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]
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
A Rankine steam power plant is considered. Saturated water vapor enters a turbine at 8 MPa and exits at condenser at 10 kPa. The
Ray Of Light [21]

Answer:

0.31

126.23 kg/s

Explanation:

Given:-

- Fluid: Water

- Turbine: P3 = 8MPa , P4 = 10 KPa , nt = 85%

- Pump: Isentropic

- Net cycle-work output, Wnet = 100 MW

Find:-

- The thermal efficiency of the cycle

- The mass flow rate of steam

Solution:-

- The best way to deal with questions related to power cycles is to determine the process and write down the requisite properties of the fluid at each state.

First process: Isentropic compression by pump

       P1 = P4 = 10 KPa ( condenser and pump inlet is usually equal )

      h1 = h-P1 = 191.81 KJ/kg ( saturated liquid assumption )

       s1 = s-P1 = 0.6492 KJ/kg.K

       v1 = v-P1 = 0.001010 m^3 / kg

       

       P2 = P3 = 8 MPa( Boiler pressure - Turbine inlet )

       s2 = s1 = 0.6492 KJ/kg.K   .... ( compressed liquid )

- To determine the ( h2 ) at state point 2 : Pump exit. We need to determine the wok-done by pump on the water ( Wp ). So from work-done principle we have:

   

                           w_p = v_1*( P_2 - P_1 )\\\\w_p = 0.001010*( 8000 - 10 )\\\\w_p = 8.0699 \frac{KJ}{kg}

- From the following relation we can determine ( h2 ) as follows:

                          h2 = h1 + wp

                          h2 = 191.81 + 8.0699

                          h2 = 199.88 KJ/kg

                           

Second Process: Boiler supplies heat to the fluid and vaporize

- We have already evaluated the inlet fluid properties to the boiler ( pump exit property ).

- To determine the exit property of the fluid when the fluid is vaporized to steam in boiler ( super-heated phase ).

              P3 = 8 MPa

              T3 = ?  ( assume fluid exist in the saturated vapor phase )

              h3 = hg-P3 = 2758.7 KJ/kg

              s3 = sg-P3 = 5.7450 KJ/kg.K

- The amount of heat supplied by the boiler per kg of fluid to the water stream. ( qs ) is determined using the state points 2 and 3 as follows:

                          q_s = h_3 - h_2\\\\q_s = 2758.7 -199.88\\\\q_s = 2558.82 \frac{KJ}{kg}

Third Process: The expansion ( actual case ). Turbine isentropic efficiency ( nt ).

- The saturated vapor steam is expanded by the turbine to the condenser pressure. The turbine inlet pressure conditions are similar to the boiler conditions.

- Under the isentropic conditions the steam exits the turbine at the following conditions:

             P4 = 10 KPa

             s4 = s3 = 5.7450 KJ/kg.K ... ( liquid - vapor mixture phase )

             

- Compute the quality of the mixture at condenser inlet by the following relation:

                           x = \frac{s_4 - s_f}{s_f_g} \\\\x = \frac{5.745- 0.6492}{7.4996} \\\\x = 0.67947

- Determine the isentropic ( h4s ) at this state as follows:

                          h_4_s = h_f + x*h_f_g\\\\h_4_s = 191.81 + 0.67947*2392.1\\\\h_4_s = 1817.170187 \frac{KJ}{kg}        

- Since, we know that the turbine is not 100% isentropic. We will use the working efficiency and determine the actual ( h4 ) at the condenser inlet state:

                         h4 = h_3 - n_t*(h_3 - h_4_s ) \\\\h4 = 2758.7 - 0.85*(2758.7 - 181.170187 ) \\\\h4 = 1958.39965 \frac{KJ}{kg} \\

- We can now compute the work-produced ( wt ) due to the expansion of steam in turbine.

                        w_t = h_3 - h_4\\\\w_t = 2758.7-1958.39965\\\\w_t = 800.30034 \frac{KJ}{kg}

- The net power out-put from the plant is derived from the net work produced by the compression and expansion process in pump and turbine, respectively.

                       W_n_e_t = flow(m) * ( w_t - w_p )\\\\flow ( m ) = \frac{W_n_e_t}{w_t - w_p} \\\\flow ( m ) = \frac{100000}{800.30034-8.0699} \\\\flow ( m ) = 126.23 \frac{kg}{s}

Answer: The mass flow rate of the steam would be 126.23 kg/s

- The thermal efficiency of the cycle ( nth ) is defined as the ratio of net work produced by the cycle ( Wnet ) and the heat supplied by the boiler to the water ( Qs ):

                        n_t_h = \frac{W_n_e_t}{flow(m)*q_s} \\\\n_t_h = \frac{100000}{126.23*2558.82} \\\\n_t_h = 0.31

Answer: The thermal efficiency of the cycle is 0.31

       

   

7 0
3 years ago
Which of the following statements about resistance is TRUE?
valentina_108 [34]

Answer:

I think it's the no 3rd

Explanation:

hope this helps

3 0
2 years ago
Can you use isentropic efficiency for a non-adiabatic compressor?
vodomira [7]
Mark brainliest please!

Isothermal work will be less than the adiabatic work for any given compression ratio and set of suction conditions. The ratio of isothermal work to the actual work is the isothermal efficiency. Isothermal paths are not typically used in most industrial compressor calculations.

Compressors

Compressors are used to move gases and vapors in situations where large pressure differences are necessary.

Types of Compressor

Compressors are classified by the way they work: dynamic (centrifugal and axial) or reciprocating. Dynamic compressors use a set of rotating blades to add velocity and pressure to fluid. They operate at high speeds and are driven by steam or gas turbines or electric motors. They tend to be smaller and lighter for a given service than reciprocating machines, and hence have lower costs.

Reciprocating compressors use pistons to push gas to a higher pressure. They are common in natural gas gathering and transmission systems, but are less common in process applications. Reciprocating compressors may be used when very large pressure differences must be achieved; however, since they produce a pulsating flow, they may need to have a receiver vessel to dampen the pulses.

The compression ratio, pout over pin, is a key parameter in understanding compressors and blowers. When the compression ratio is below 4 or so, a blower is usually adequate. Higher ratios require a compressor, or multiple compressor stages, be used.

When the pressure of a gas is increased in an adiabatic system, the temperature of the fluid must rise. Since the temperature change is accompanied by a change in the specific volume, the work necessary to compress a unit of fluid also changes. Consequently, many compressors must be accompanied by cooling to reduce the consequences of the adiabatic temperature rise. The coolant may flow through a jacket which surrounds the housing with liquid coolant. When multiple stage compressors are used, intercooler heat exchangers are often used between the stages.

Dynamic Compressors

Gas enters a centrifugal or axial compressor through a suction nozzle and is directed into the first-stage impeller by a set of guide vanes. The blades push the gas forward and into a diffuser section where the gas velocity is slowed and the kinetic energy transferred from the blades is converted to pressure. In a multistage compressor, the gas encounters another set of guide vanes and the compression step is repeated. If necessary, the gas may pass through a cooling loop between stages.

Compressor Work

To evaluate the work requirements of a compressor, start with the mechanical energy balance. In most compressors, kinetic and potential energy changes are small, so velocity and static head terms may be neglected. As with pumps, friction can be lumped into the work term by using an efficiency. Unlike pumps, the fluid cannot be treated as incompressible, so a differential equation is required:

Compressor Work
Evaluation of the integral requires that the compression path be known - - is it adiabatic, isothermal, or polytropic?
uncooled units -- adiabatic, isentropic compression
complete cooling during compression -- isothermal compression
large compressors or incomplete cooling -- polytropic compression
Before calculating a compressor cycle, gas properties (heat capacity ratio, compressibility, molecular weight, etc.) must be determined for the fluid to be compressed. For mixtures, use an appropriate weighted mean value for the specific heats and molecular weight.

Adiabatic, Isentropic Compression

If there is no heat transfer to or from the gas being compressed, the porocess is adiabatic and isentropic. From thermodynamics and the study of compressible flow, you are supposed to recall that an ideal gas compression path depends on:

Adiabatic Path
This can be rearranged to solve for density in terms of one known pressure and substituted into the work equation, which then can be integrated.
Adiabatic Work
The ratio of the isentropic work to the actual work is called the adiabatic efficiency (or isentropic efficiency). The outlet temperature may be calculated from
Adiabatic Temperature Change
Power is found by multiplying the work by the mass flow rate and adjusting for the units and efficiency.
Isothermal Compression

If heat is removed from the gas during compression, an isothermal compression cycle may be achieved. In this case, the work may be calculated from:

http://facstaff.cbu.edu/rprice/lectures/compress.html
4 0
3 years ago
________ are written to “maximize” or “minimize” a specific value associated with the product needs in order to define the goal
Anna35 [415]

Answer:

Objective statements.

Explanation:

An objective statement can be defined as a short statement that explicitly states or describes what a person wants exactly or is looking out for in a particular item.

Objective statements are written to “maximize” or “minimize” a specific value associated with the product needs in order to define the goal or aim of the design process.

This ultimately implies that, objective statements are used by various manufacturing industries or companies to explicitly define the minimum or maximum requirements for the production of its goods.

4 0
3 years ago
Read 2 more answers
Question # 3
tino4ka555 [31]

Answer:

I think it's False.

Apologies if I am wrong.

4 0
3 years ago
Read 2 more answers
Other questions:
  • The following C program asks the user for two input null-terminated strings, each stored in uninitialized 100-byte buffer, and c
    6·1 answer
  • A heat engine does 210 J of work per cycle while exhausting 440 J of waste heat. Part A What is the engine's thermal efficiency?
    6·1 answer
  • The 40-ft-long A-36 steel rails on a train track are laid with a small gap between them to allow for thermal expansion. Determin
    8·1 answer
  • In dynamics, the friction force acting on a moving object is always a) in the same direction of its motion b) a kinetic friction
    15·1 answer
  • Fix the code so the program will run correctly for MAXCHEESE values of 0 to 20 (inclusive). Note that the value of MAXCHEESE is
    8·1 answer
  • Let CFG G be the following grammar.
    7·2 answers
  • A spring-loaded piston-cylinder contains 1 kg of carbon dioxide. This system is heated from 104 kPa and 25 °C to 1,068 kPa and 3
    6·1 answer
  • This app, I'm done, bye... I can't, bye
    11·1 answer
  • What effect will increasing numbers of high-profile green building projects likely have on thinking about building?
    5·1 answer
  • أجوبة على مسائل في الإستاتيكا أيمكن ذالك
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!