Write a C program for the Apex Plastic Spoon Manufacturing C

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: ********

Solution

#include <iostream>
using namespace std;

int main()
{
   int plant[10],i,j; //array plant[] for 10 manufacturing plants
  
   cout<<\"\ Enter the list of productions<1-10> for 10 manufacturing plants\"<<endl;
   for(i=0;i<10;i++)
   {
       cin>>plant[i]; //enter the number giving production for each plant
   }
   for(i=0;i<10;i++)
   {
       cout<<\"Plant #\"<<i+1<<\": \";
       for(j=0;j<plant[i];j++)
       cout<<\"*\"; //for the number of productions display * for each plant
       cout<<endl;
   }
  
   return 0;
}

output:

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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site