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
Mars2501 [29]
2 years ago
7

(1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the arr

ay's numbers on one line, each number followed by one space. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 142.0 Enter weight 4: 166.3 Enter weight 5: 93.0 You entered: 236.0 89.5 142.0 166.3 93.0 (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) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 142.0 Enter weight 4: 166.3 Enter weight 5: 93.0 You entered: 236.0 89.5 142.0 166.3 93.0 Total weight: 726.8 Average weight: 145.35999999999999 Max weight: 236.0
Computers and Technology
1 answer:
Mashutka [201]2 years ago
6 0

Answer:

weights = []

total = 0

max = 0

for i in range(5):

   weight = float(input("Enter weight " + str(i+1) + ": "))

   weights.append(weight)

   total += weights[i]

   if weights[i] > max:

       max = weights[i]

average = total / 5

print("Your entered: " + str(weights))

print("Total weight: " + str(total))

print("Average weight: " + str(average))

print("Max weight: " + str(max))

Explanation:

Initialize the variables

Create a for loop that iterates 5 times

Get the values from the user

Put them inside the array

Calculate the total by adding each value to the total

Calculate the max value by comparing each value

When the loop is done, find the average - divide the total by 5

Print the results

You might be interested in
You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
vagabundo [1.1K]

Answer:

The answer is "check the worksheet is not read only"

Explanation:

The read only mode is used for read the file data, and it doesn't allows the user to update the file, and for updating the worksheet we should check iut does not open in the read-only mode.

If it is open, then we close it and for close we goto the office button and click on the tools option after that goto general setting, in this there is a check box for turn off the read-only mode.

 

8 0
2 years ago
Extend the functionality of cout by implementing a friend function in Number.cpp that overloads the insertion operator. The over
san4es73 [151]

Answer:

// In the number.cpp file;

#include "Number.h"

#include <iostream>

using namespace std;

Number::Number(int number)

{

   num = number;

}

void Number::SetNum(int number)

{

   num = number;

}

int Number::GetNum()

{

   return num;

}

ostream &operator<<(ostream &out, const Number &n)

{

   out << "The value is " << n.num << endl;

   return out;

}

// in the main.cpp file;

#include "Number.cpp"

#include <iostream>

using namespace std;

int main()

{

   int input;

   cin >> input;

   Number num = Number(input);

   cout << num;  

   return 0;

}

Explanation:

The main function in the main.cpp file prompts the user for the integer value to be displayed. The Number file contains defined functions and methods of the number class to set, get and display the "num" variable.

7 0
1 year ago
PYTHON QUESTION
valkas [14]

Answer:

First_Number =input("Enter your first number")

Last_Number =input("Enter your last number")

tup1=(First_Number, Last_Number)

print(tup1)

Explanation:

The above Python program asks the user to input two numbers, and then it creates a tuple out of it, and finally prints the tuple. Remember tuple uses () and the tuple items are mentioned inside it and are separated by a comma. And we can print tuple fully through the print statement mentioned above in the program. Remember that tuples are immutable, and this means you cannot update or change the values of the tuple. However, you can concatenate two tuples.

3 0
2 years ago
Write a single statement that prints outsideTemperature with 2 digits in the fraction (after the decimal point). End with a newl
klemol [59]

Answer:

#include<ios>// HEADER FILe

#include<iomanip> // HEADER FILE

using namespace std;// namespace  

int main() // main function

{

double tem=103.45632; // variable declaration

cout<<" The outside Temperature is:";

cout<<fixed<<setprecision(2)<<tem; // display

return 0;

}

Explanation:

<u>The following are the description of the program</u>.

  • set the required header files and namespaces, then declare the main method and inside the main function.
  • Set the double data type variable 'tem' and initialize the value '103.45632'.
  • Finally, print the following message and print the output through the cout that is predefined function.
5 0
2 years ago
Read 2 more answers
Into which of these files would you paste copied information to create an integrated document?
Oksanka [162]
D cause you will need to keep up with data also
7 0
1 year ago
Read 2 more answers
Other questions:
  • What permanent magnets of a motor are replaced with more powerful ones, what effect do you think this would have on motor rotati
    12·2 answers
  • Which statement best describes how the rapid prototyping model works?a) Developers create prototypes to show stakeholders how va
    11·2 answers
  • Jacob wants to be a Steamfitter. He just finished his associate’s degree. Which best describes what he should do next?
    10·2 answers
  • Which computer applications can Mr. Crowell use to make the classroom learning more stimulating and interesting? Mr. Crowell has
    9·2 answers
  • Which of the following is true of information systems?
    15·1 answer
  • Which word in brackets is most opposite to the word in capitals? PROSCRIBE (allow, stifle, promote, verify)​
    14·2 answers
  • Which type of word processing programs enables us to include illustrations within the program?
    6·1 answer
  • Match common encryption algorithms and methods with the scenarios representing real-world business applications and requirements
    14·1 answer
  • A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
    5·1 answer
  • Which of the following would not be considered metadata for a spreadsheet file?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!