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
Nataly_w [17]
2 years ago
8

You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you re

alize that some boxcars are overloaded and weigh too heavily on the rails while others are dangerously light. So you decide to stop the train and spread the weight more evenly so that all the boxcars have exactly the same weight (without changing the total weight). For that you write a program which helps you in the distribution of the weight.
Your program should first read the number of cars to be weighed (integer) followed by the weights of the cars (doubles). Then your program should calculate and display how much weight to add or subtract from each car such that every car has the same weight. The total weight of all of the cars should not change. These additions and subtractions of weights should be displayed with one decimal place. You may assume that there are no more than 50 boxcars.
Example 1
In this example, there are 5 boxcars with different weights summing to 110.0. The ouput shows that we are modifying all the boxcars so that they each carry a weight of 22.0 (which makes a total of 110.0 for the entire train). So we remove 18.0 for the first boxcar, we add 10.0 for the second, we add 2.0 for the third, etc.
Input
5
40.0
12.0
20.0
5. 33.
0
Output
- 18.0
10.0
2.0
17.0
-11.0
Computers and Technology
1 answer:
maks197457 [2]2 years ago
4 0

Answer:

The program in C++ is as follows:

#include <iostream>

#include <iomanip>

using namespace std;

int main(){

   int cars;

   cin>>cars;

   double weights[cars];

   double total = 0;

   for(int i = 0; i<cars;i++){

       cin>>weights[i];

       total+=weights[i];    }

   double avg = total/cars;

   for(int i = 0; i<cars;i++){

       cout<<fixed<<setprecision(1)<<avg-weights[i]<<endl;    }

   return 0;

}

Explanation:

This declares the number of cars as integers

   int cars;

This gets input for the number of cars

   cin>>cars;

This declares the weight of the cars as an array of double datatype

   double weights[cars];

This initializes the total weights to 0

   double total = 0;

This iterates through the number of cars

   for(int i = 0; i<cars;i++){

This gets input for each weight

       cin>>weights[i];

This adds up the total weight

       total+=weights[i];    }

This calculates the average weights

   double avg = total/cars;

This iterates through the number of cars

   for(int i = 0; i<cars;i++){

This prints how much weight to be added or subtracted

       cout<<fixed<<setprecision(1)<<avg-weights[i]<<endl;    }

You might be interested in
quizlet ann is a security professional for a midsize business and typically handles log analysis and security monitoring tasks f
Sergio039 [100]

At this point in the incident response process, the term that best describes what has occurred in Ann's organization is known to be C. Security event.

What is the security event?

A security event is known to be an alteration  in the day to day running of the operations of a network or an information technology service and it is one that tends to show the point that a security policy need to have been violated or a security safeguard could have failed.

Note that in the above point in the process, Ann is a person who see no reason to believe that any real security compromise or policy violation has occurred as this kind of situation does not meet the stage of been called a security incident or intrusion.

Therefore, based on the above, At this point in the incident response process, the term that best describes what has occurred in Ann's organization is known to be C. Security event.

Learn more about Security event from

brainly.com/question/27225071
#SPJ1

Ann is a security professional for a mid-sized business and typically handles log analysis and security monitoring tasks for her organization. One of her roles is to monitor alerts originating from the organization's intrusion detection system. The system typically generates several dozen alerts each day, any many of those alerts turn out to be false alarms after her investigation.

This morning, the intrusion detection system alerted because that network began to recieve an unusually high volume of inbound traffic. Ann recieved this alert and began looking into the orgin of the traffic.

65. At this point in the incident response process, what term best describes what has occurred in Ann's organization?

A. Security occurrence

B. Security incident

C. Security event

D. Security intrusion

8 0
1 year ago
Find and record a set of instructions containing a repetition clause (e.g., instructions on a shampoo bottle, a recipe, etc.). H
Leto [7]

This question belongs to scratch programming. This programming language has various instructions to carry out various tasks. There are different types of repeat statement available. This statement or instruction allows the user / programmer to repeat certain line of statements to a number of times. Here, according to the question, we need to use “Repeat after me”

If you take a music note, the tempo, timing and pitch needs to be mentioned clearly and “:” represents that a particular note to be repeated only once.

3 0
3 years ago
Which of the following are reasons why it is important to properly recycle electronic equipment? Select all that apply.
faltersainse [42]
I think it is C. Sorry if I am wrong
4 0
3 years ago
Read 2 more answers
Look at the slide.
svetlana [45]

Answer:

c

Explanation:

5 0
2 years ago
Read 2 more answers
Which of the following are breach prevention best practices?Access only the minimum amount of PHI/personally identifiable inform
Rudiy27

Answer:

All of this above.

Explanation:

All the mentioned practices can be use to prevent breaches.

6 0
3 years ago
Other questions:
  • ____ are systems in which queues of objects are waiting to be served by various servers
    5·1 answer
  • Given positive integer numInsects, write a while loop that prints that number doubled without reaching 100. Follow each number w
    8·1 answer
  • What contains the computer brain the central processing unit
    8·2 answers
  • Encyclopedia.com is considered to be
    15·1 answer
  • Technician A says that the engine block is the solid frame from which all automotive and truck engines are constructed and is ma
    10·2 answers
  • Develop a Java program that determines the gross pay for an employee. The company pays hourly rate for the first 40 hours worked
    8·1 answer
  • The function below takes two parameters: a string parameter: CSV_string and an integer index. This string parameter will hold a
    14·1 answer
  • Richard needs to copy information from another slide presentation that uses a different design template. To ensure that the info
    10·1 answer
  • 1. Do our shared social experiences lead us to think<br><br> communication is a cure-all?
    13·1 answer
  • What are the impacts of mobile phone?as well as the positive and negative impacts?​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!