Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program for the Apex Plastic Spoon Manufacturing Company that will d

ID: 3683150 • Letter: W

Question

Write a C++ program for the Apex Plastic Spoon Manufacturing Company that will display a bar graph showing the productivity of its ten manufacturing plants for any given week. There are 10 manufacturing plants. (You can store their information in an array of 10 integers). A list of numbers giving the production of each plant is read from the user. This number ranges from 1 to 10 .  For example, first's plant production is 5. The program will then display a bar graph showing the total production for each plant. Each asterisk in the bar graph equals 1 units. This means that for first plan you will display five stars.

In your program,

1- declare the array production. We have 10 plants. Each of the 10 cells will correspond to a plant.

2- ask the user to enter production amount for each plant. State that this amount should be between 1 and 10.

3- Display the graph with each's plant information on a separate line and labeled with the number of plant.

Array cell 0 holds 5 // corresponds to plant 1

array cell 1 holds 3 // corresponds to plant 2

array cell 2 holds 7 // corresponds to plant 3

The following will be displayed

Plant #1: *****

Plant #2: ***

Plant #2: ********

Explanation / Answer


#include <iostream>
const int NUMBER_OF_PLANTS = 4;
void input_data(int a[], int last_plant_number);
//Precondition: last_plant_number is the declared size of the array a.
//Postcondition: For plant_number = 1 through last_plant_number:
//a[plant_number1] equals the total production for plant number plant_number.
void scale(int a[], int size);
//Precondition: a[0] through a[size1] each has a nonnegative value.
//Postcondition: a[i] has been changed to the number of 1000s (rounded to
//an integer) that were originally in a[i], for all i such that 0 <= i <= size1.
void graph(const int asterisk_count[], int last_plant_number);
//Precondition: asterisk_count[0] through asterisk_count[last_plant_number1]
//have nonnegative values.
//Postcondition: A bar graph has been displayed saying that plant
//number N has produced asterisk_count[N1] 1000s of units, for each N such that
//1 <= N <= last_plant_number
int main( )
{
using namespace std;
int production[NUMBER_OF_PLANTS];
cout << "This program displays a graph showing "
<< "production for each plant in the company. ";
input_data(production, NUMBER_OF_PLANTS);
scale(production, NUMBER_OF_PLANTS);
graph(production, NUMBER_OF_PLANTS);
return 0;
}


void input_data(int a[], int last_plant_number)
{
using namespace std;
for (int plant_number = 1;
plant_number <= last_plant_number; plant_number++)
{
cout << endl
<< "Enter production data for plant number "
<< plant_number << endl;
get_total(a[plant_number 1]);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote