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
1).
Ulleksa [173]

Answer:

option 1

Explanation:

its not a job application cause your not appling for a job, a resume is a list of all the things you have done that would be beneficial to a job. for example, previous jobs, skills you have, hobby that pertain to a job you want, education and other professional things.

Hope this helps:)

7 0
3 years ago
Which camera is interchangeable<br><br> freeform<br><br> hybrid<br><br> DSLR<br><br> point and shoot
soldier1979 [14.2K]

Answer:

DSLR

Explanation:

Double check my answer

3 0
2 years ago
In the context of machine learning, an artificial neural network (ann) is most likely used for?
Marianna [84]

In the context of machine learning, an artificial neural network (ANN) exists most likely utilized for oil and gas exploration (Option c).

<h3>What is machine learning?</h3>
  • Machine learning (ML) guides to a kind of artificial intelligence based on computer algorithms capable of producing predictions without being programmed to do so.

  • Machine learning algorithms are used in various industries, including, among others, medical diagnostics, bioinformatics, image processing, modification of hygiene in production plans, etc.

  • Moreover, an artificial neural network (ANN) directs to a machine learning technique that receives inputs and then delivers explicit outputs regarding predefined activation functions.

  • This kind of computation network (artificial neural network) exists similar to neuronal biological networks carried out by neurons.

Hence, In the context of machine learning, an artificial neural network (ANN) exists most likely utilized for oil and gas exploration (Option c).

To learn more about Machine learning refer to:

brainly.com/question/25523571

#SPJ4

The complete question is,

In the context of machine learning, an artificial neural network (ANN) is most likely used for

a. Supplying explanations for solutions.

b. problems that require the use of if-then-else rules.

c. oil and gas exploration.

d. portfolio development and analysis.

7 0
1 year ago
Define input hardware​
luda_lava [24]
It’s a piece of hardware (you can touch it) that changes something on the screen. Examples are a keyboard putting letters on the screen or a mouse moving the cursor
6 0
2 years ago
A systems flowchart:
Musya8 [376]

Answer: (D)  Must always have a data store if there are paper documents involved.

Explanation:

 A system flowchart is basically responsible for displaying the data in the system and also control the flow of data. The system flowchart are basically use various graphic symbol for representing the systematic manner for processing the output.

It basically contain data store in the system if there is data documents present in the system so that it make easy to store the data in the system.

There are basically four symbols that is use to represent in the program flowchart is that are: Firstly start, processing, decision making and then end.

6 0
3 years ago
Other questions:
  • The rod and crankshaft convert the up-and-down motion of the piston into
    12·2 answers
  • Ryan is the operations manager for a national financial company. His company is in the process of creating a customer handbook.
    13·1 answer
  • Your mom is trying to save room on her hard drive and wants to uninstall some of her applications. She asks you how to do this.
    9·2 answers
  • Jawana has been working on a paper for her Anatomy class for weeks. One day her little brother was on her computer and accidenta
    14·1 answer
  • For a wire with a circular cross section and a diameter = 3.00mm calculate the following: (m means meter. mm means millimeter. c
    5·1 answer
  • The process known as "bitmapping" is defined as information in _____. PLEASE HELP FAST
    11·1 answer
  • The term integration mean?
    7·2 answers
  • Define a function in Scheme (or relation in Prolog) that checks whether a set of elements (represented as a list) is a subset of
    10·1 answer
  • 3. Special keys labelled Fl to F12.
    8·1 answer
  • To use the replace feature we can simply just press Carl+h,Carl+c,Carl+r
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!