Question
USING FUNCTIONS AND ARRAYS Each bin in a warehouse holds a quantity of the same type of parts. Your program should use a structure that
USING FUNCTIONS AND ARRAYS
Each bin in a warehouse holds a quantity of the same type of parts. Your program should use a structure that keeps the following data for each part:
Description of the part kept in the bin
Number of parts in the bin
Price of the part
The program should have an array of 10 bins, initialized with the following data:
Part Description Quantity Price
Chain 10 8.99
Handlebar 5 19.95
Pedals 15 7.99
Chainring 21 8.99
Cassette 7 10.99
Wheel 5 53.99
Saddle 5 29.95
Derailleur 25 11.99
Seat post 18 7.49
Tire 12 9.99 1
When the program runs, it should repeat a loop that performs the following steps: The user should see a list of what each bin holds and how many parts are in each bin. The user can choose to either quit the program or select a bin. When a bin is selected, the user can either add parts to it or remove parts from it. The loop then repeats, showing the updated bin data on the screen.
When the user quits the program, the program should display a message indicating the total value of the current inventory, and which part has the maximum quantity. Please see sample output in the file output1.txt on the class website.
Note: your output should look at least as nice as mine (data lined up in columns, money formatted to two decimal points, etc). Your program must include four functions:
one to display the parts and quantity (NOT the prices),
one to process the users selection (to add or remove a certain number of parts for a given bin),
one to determine the total value of the current inventory, and
one to determine which part has the highest quantity. These functions should take an array of Category (and perhaps other values) as arguments.
The program should have an array of 10 bins, initialized with the following data: Part Description Quantity Price Chain 8.99 Handlebar 19.95 Pedals 7.99 Chainring 8.99 Cassette 10.99 Wheel 53.99 Saddle 29.95 Derailleur 11.99 7.49 Seat post 18 Tire 12 9.99 Parts Inventory 1 Chain 2 Handlebar 3 Pedals 4 Chainring 5 Cassette 6 Wheel 7 Saddle 8 Derailleur 9 Seat post 10 Tire Select a bin or 11 to quit. 12 Invalid selection. 5 Parts Inventory 1 Chain 2 Handlebar 3 Pedals 4 Chainring 5 Cassette 6 Wheel 7 Saddle 8 Derailleur 9 Seat post 10 Tire Select a bin or 11 to quit. 10 To add parts, enter A and the amount to add, To remove parts, enter R and the amount to remove: A 3 12 Parts Inventory 1 Chain 2 Handlebar 3 Pedals 4 Chainring 5 Cassette 6 Wheel 7 Saddle 8 Derailleur 9 Seat post 10 Tire Select a bin or 11 to quit. 11 Total value of current inventory: $1504.39 Part with the maximum quantity: Chainring Parts Inventory 1 Chain 2 Handlebar 3 Pedals 4 Chainring 5 Cassette 6 Wheel 7 Saddle 8 Derailleur 9 Seat post 10 Tire Select a bin or 11 to quit. To add parts, enter A and the amount to add, To remove parts, enter R and the amount to remove: A 5 Parts Inventory 1 Chain 2 Handlebar 3 Pedals 4 Chainring 5 Cassette 6 Wheel 7 Saddle 8 Derailleur 9 Seat post 10 Tire 12 Select a bin or 11 to quit. cuvao To add parts, enter A and the amount to add, To remove parts, enter R and the amount to remove: R 10 Parts Inventory 1 Chain 2 Handlebar 3 Pedals 4 Chainring 5 Cassette 6 Wheel 7 Saddle 8 Derailleur 9 Seat post 10 Tire Select a bin or 11 to quit. 7 To add parts, enter A and the amount to add, To remove parts, enter R and the amount to remove: R6 Error: not enough parts to remove Guuuuu
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started