Inventory Application Program
This project involves designing and creating a C++ program which will utilize the InventoryItem class, which is described in Section 13.10 (pages 771-775) and Section 13.12 (pages 777-780) of the Gaddis textbook. (The InventoryItem.h source code for this class is provided on Moodle.)
The program should create an array of 100 InventoryItem objects and support the following interactive commands:
a Add parts: increase the units value for an existing inventory
h print Help
i Input inventory data from a
p Print inventory list.
n create a New inventory
o Output inventory data to a
q quit (end the program).
r Remove parts: reduce the units value for an existing inventory
Data File Format
The “input” / “output” commands read / write data which is in a “pipe-delimited” text file. The format of each line of text, in the data file, is described below:
File Format |
inventory item number | description | cost | units |
Explanation of Data Fields |
|
Field name |
Explanation |
inventory item number |
For the output file, this number can be the same as the array index. For the input file, the contents of this field will be ignored, because the input data will be appended to the end of the “populated” portion of the InventoryItem array. |
description |
Description of the inventory item |
cost |
Cost per unit for the inventory item |
units |
Number of units present for the inventory item (must be greater than or equal to zero and less than or equal to 30). |
Sample Test Data
Four sample input files are provided: electrical.txt, fasteners.txt, miscellaneous.txt and plumbing.txt. The data files which your program creates must obey the same file format as these sample files.The program should work correctly with these files, as well as general files of similar format.
electrical.txt |
0|Cable|5.00|18 1|Extension Cord (14/3, 25 ft)|27.95|6 2|Light switch (15 amp)|2.79|10 3|Ceiling Fan (52 inch)|79.95|3 4|Vinyl Electrical Tape (20 ft roll)|0.79|30 5|GFI Tester|9.35|5 |
fasteners.txt |
0|Turnbuckle|3.80|25 1|Siding nails (box of 100)|4.00|20 2|Flat washer (box of 100)|2.80|30 3|Machine screw (box of 100)|3.20|10 4|Hex bolt (box of 100)|6.50|23 5|Hex nut (box of 100)|3.80|15 6|Sheet Metal Screw (qty 100)|1.50|28 |
miscellaneous.txt |
0|Door Hinges (3-pack)|6.30|10 1|Rubber work boots (1 pair)|28.00|5 2|Leather Work Gloves (1 pair)|12.00|8 3|Long Handle Grass Shear|30.00|5 |
plumbing.txt |
0|Pump|39.00|20 1|Gasket|1.50|29 2|Water Level Guage|12.99|30 3|Faucet Repair Kit|4.89|8 4|Teflon Thread Seal Tape (50 ft roll)|3.30|12 5|shutoff valve|6.50|10 |
Sample Interactive Session
In the sample data on the next several pages, what the user types is shown in bold. In actuality, what the user types would appear as the same text format as the rest of the output.
Sample Interactive Session |
Command: h Supported commands: a Add parts. h print Help text. i Input inventory data from a file. p Print inventory list. n New inventory Item. o Output inventory data to a file. q quit (end the program). r Remove parts.
Command: i Enter name of input file: plumbing.txt 6 records loaded to array. Command: p Item Num Description Cost Quantity 0 Pump 39.00 20 1 Gasket 1.50 29 2 Water Level Guage 12.99 30 3 Faucet Repair Kit 4.89 8 4 Teflon Thread Seal Tape (50 ft roll) 3.30 12 5 shutoff valve 6.50 10 6 records. Command: i Enter name of input file: electrical.txt 6 records loaded to array. Command: p Item Num Description Cost Quantity 0 Pump 39.00 20 1 Gasket 1.50 29 2 Water Level Guage 12.99 30 3 Faucet Repair Kit 4.89 8 4 Teflon Thread Seal Tape (50 ft roll) 3.30 12 5 shutoff valve 6.50 10 6 Cable 5.00 18 7 Extension Cord (14/3, 25 ft) 27.95 6 8 Light switch (15 amp) 2.79 10 9 Ceiling Fan (52 inch) 79.95 3 10 Vinyl Electrical Tape (20 ft roll) 0.79 30 11 GFI Tester 9.35 5 12 records. |
Sample Interactive Session |
Command: a Choose a Item Number: 7 How many parts to add? 5 Command: p Item Num Description Cost Quantity 0 Pump 39.00 20 1 Gasket 1.50 29 2 Water Level Guage 12.99 30 3 Faucet Repair Kit 4.89 8 4 Teflon Thread Seal Tape (50 ft roll) 3.30 12 5 shutoff valve 6.50 10 6 Cable 5.00 18 7 Extension Cord (14/3, 25 ft) 27.95 11 8 Light switch (15 amp) 2.79 10 9 Ceiling Fan (52 inch) 79.95 3 10 Vinyl Electrical Tape (20 ft roll) 0.79 30 11 GFI Tester 9.35 5 12 records. Command: r Choose a Item Number: 9 How many parts to remove? 5 Error: You are attempting to remove more parts than the Item currently holds. Command: r Choose a Item Number: 9 How many parts to remove? 3 Command: p Item Num Description Cost Quantity 0 Pump 39.00 20 1 Gasket 1.50 29 2 Water Level Guage 12.99 30 3 Faucet Repair Kit 4.89 8 4 Teflon Thread Seal Tape (50 ft roll) 3.30 12 5 shutoff valve 6.50 10 6 Cable 5.00 18 7 Extension Cord (14/3, 25 ft) 27.95 11 8 Light switch (15 amp) 2.79 10 9 Ceiling Fan (52 inch) 79.95 0 10 Vinyl Electrical Tape (20 ft roll) 0.79 30 11 GFI Tester 9.35 5 12 records. Command: o |
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of