Write a C++ program for the Apex Plastic Spoon Manufacturing Company that will d
ID: 3683258 • 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.h>
#include<conio.h>
void main()
{
int production[10],i,j,n;
for(i=0;i<10;i++)
{
cout<<"enter production for plant"<<i+1;
cin>>production[i];
}
cout<<"The Bar Graph is:"<<endl;
for(i=0;i<10;i++)
{
cout<<"Plant #"<<i+1<<": ";
for(j=0;j<production[i];j++)
cout<<"*";
cout<<endl;
}
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.