Write a C++ program for the Apex Plastic Spoon Manufacturing Company that will d
ID: 3683265 • 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>
using namespace std;
int main()
{
int production[10];
cout << "Enter the production amount between 1 and 10"<<endl;
for(int i=0;i<10;i++)
{
cout<<"Enter amount of Plant "<<i;
cin>>production[i];
}
cout<<endl<<"Plant Information";
for(int i=0;i<10;i++)
cout<<"Array cell "<<i<<" holds "<<production[i]<<endl;
cout<<endl<<"Bar Graph of plants";
for(int i=0;i<10;i++)
{
cout<<endl<<"Plant #"<<i<<": ";
for(int j=0;j<production[i];j++)
cout<<"*";
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.