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
Suppose that a discrete-time signal x(n) is processed by the system with transfer function H (z)=0.01/(z+0.99) before sent to a
PtichkaEL [24]

Answer:

Detailed solution is given below:

8 0
3 years ago
Combining two strings is called
a_sh-v [17]

Answer:

The appropriate response is "Concatenation". A further explanation is given below.

Explanation:

  • Two or much more strings are almost always concatenated besides space-saving purposes, and therefore could be acknowledged as either a single product.
  • A straightforward example that demonstrates concatenation should be to figure out what it means. How and why that ends up making a term separate from several other phrases is that almost all the messages are stacked together without any open space between each one.
5 0
3 years ago
Define schema &amp; Instance...<br><br><br>don't spam..<br>​
zubka84 [21]

Answer:

<h3>Hey there ! </h3><h3>Here is your Answer Buddy | </h3>

<h3>• Define Instance :- </h3>

  • The data stored in database at a particular moment of time is called instance of database.

<h3>• Define Schema :- </h3>

  • Database schema defines the variable declarations in tables that belong to a particular database

<h3><u>The value of these variables at a moment of time is called the instance of that database.</u></h3><h3 />

Explanation:

<h3>Hope this helps !! </h3>
4 0
3 years ago
Read 2 more answers
How to create a machine that can create anything without any limitations
n200080 [17]

Answer:

Wayback machine

Explanation:

Wayback Machine

calls a "three dimensional index". Kahle and Gilliat created the machine hoping to archive the entire Internet and provide "universal access to all knowledge

7 0
3 years ago
The Reynolds number is a dimensionless quantity used in fluid mechanics. It is defined as:where d is the pipe diameter, v is the
ELEN [110]
Lb(force)•second/ft^2
6 0
4 years ago
Other questions:
  • A ring-shaped seal, made from a viscoelastic material, is used to seal a joint between two rigid pipes. When incorporated in the
    5·1 answer
  • 10 kg/s Propane at 10 bar and 20 C is directed to an adiabatic rigid mixer and is mixed with 20 kg/s Propane at 10 bar and 40 C.
    11·1 answer
  • The natural water content of a Boston Blue Clay soil sample was found to be 14.6% through oven drying. It has been calculated th
    8·1 answer
  • When a 2-kg block is suspended from a spring, the spring is stretched a distance of 20 mm. Determine the natural frequency and t
    14·1 answer
  • A schizophrenic disorder is characterized mostly by disturbed __________, while a mood disorder is characterized mostly by distu
    6·2 answers
  • A 90-hp (shaft output) electric car is powered by an electric motor mounted in the engine compartment. If the motor has an avera
    8·1 answer
  • What is the duty of a choreographer?
    6·2 answers
  • Need help with these 3 questions pls help
    12·1 answer
  • I am trying to test out the software Classroom relay and I am just ask if there is any way kids can stop Classroom relay form se
    9·2 answers
  • Whats the best way to find the load capacity of a crane
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!