Question
You are the owner of a new store and need to keep track of your inventory. Since you are a seasoned C++ programmer, you are
You are the owner of a new store and need to keep track of your inventory. Since you are a seasoned C++ programmer, you are going to write a C++ program to perform this function. Define a structure that will hold a part number (integer), description of the item (string), a quantity (integer), and price per item (float), and a total cost. Your program is to check to see if the file called inventory.txt already exists and if it does, read it into an array of structures. The program should have a menu that asks the user to 1) print parts 2) enter a new part 3) modify a part 4) print inventory total 5) exit the program. If the user enters 1, all of the parts will be printed to the screen. If the user enters 2, the program will ask the user for the description, quantity, and price per item and calculate the total cost. If the user selects 3, the program should ask the user for the part number to be modified and all of the new information for that part. If the user selects 5, you are to print the total cost of the inventory items to the screen. When the user selects 5 to exit the program, you are to create a new file and write each record to the text file inventory.txt. Sample output if 1 selected 1 hammer 2 $ 10.00 $ 20.00 2 drill press 1 $100.00 $100.00 Sample input if 2 selected Enter item: block sander Enter quantity: 3 Enter cost: $50.00 Sample input if 3 selected Enter part to modify: 1 1 hammer 2 $ 10.00 $ 20.00 Enter item: hammer Enter quantity: 3 Enter cost: $10.00 Sample output if 4 selected Total cost of inventory: $290
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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