Question
Dynamic Shopping System Libraries you may use: string iostream fstream iomanip The use of any other libraries will result in the loss of points. Start
Dynamic Shopping System Libraries you may use: string iostream fstream iomanip The use of any other libraries will result in the loss of points.Start a new project, define your inventory class. Create a simple main that will create your inventory class, then call a fully implemented read_inventory_data(). Prove that it works by calling print_inventory_info(). For this assignment, we will be practicing working with dynamic arrays! You are to define an inventory class with the following private data: string *items - a (dynamic) array of inventory items float *prices - a dynamic array of each item's cost int *amounts - a (dynamic) array containing the quantity of each item in stock int total_items, sale_number - (read from file) the total number of items you will store data about and the (next) sale number to be issued string inventory_file - the name of the inventory file read by read_inventory_data() so that it can be written again by store_inventory_data() You are to define the following public methods: inventory() - Make sure to initialize each array pointer to NULL ~inventory() - calls delete[] for each array when the object goes out of scope void read_inventory_data(string file_name) - opens the file file_name and reads in the data (total_items, sale_number), declares room for the appropriate number of entries in each dynamic array, and loads the inventory data from the file. You should store the file name in inventory_file so you can write data back to the file in the next method void store_inventory_data() - opens the file inventory_file and prints all inventory data back to the file it was read from including the updated sale number. Remember, your data should be readable by your program later. void print_inventory_info(int index) - prints the current quantity and price of a specific item void print_inventory_info() - prints out information about all items in the inventory. void sell_item(int index, int quantity) - assuming that there are enough of the item in inventory, will print a sales receipt for quantity of the item. Make sure to update the sale_number after this. void order_item(int index, int quantity) - restocks inventory by quantity of the specific item int find_index(string item_name) - searches the array items[] and returns the numerical index of the item with the given name(makes the implementation of the preceding three functions easier) Your program should provide the user with a menu that allows them to select between program features. Your program should read from a simple database file that stores the employee information. You can find such a file here. The file is formatted in the following manner: A single integer denoting the number of items in the inventory system The next sales number in the sequence Data for each item including (in this order):The item name The item quantity in stock The price per unit of the item You can find sample runs of the program here. NOTE: your program should write an updated version of your inventory to disk after every run. Remember to document Our programs are getting more complicated, particularly from here on out. Remember to keep good documentation. This includes documenting: Each method (at the prototype in the class definition). Each file at the top of the file. Your code in your methods and main when necessary. What you should turn in: You should turn in a zip file of your work, with the following items included: main.cpp - A driver that organizes your code and interfaces with the user. inventory.cpp - The implementation file for your class. inventory.h - A header file containing your class definition store.cbp - Including the project file makes grading easier. README - a text file describing your work, and giving a high-level overview of your design decisions. Make sure to note any extra credit work that you have done here. BONUS (2 points) Allowing your program to do only one option at a time can make it awkward. Put your menu in a loop, allowing a user to perform multiple actions before saving to disk.
use code blocks please.. |
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