Write a complete C++ program called inventory.cpp as described below. Documentat
ID: 3601505 • Letter: W
Question
Write a complete C++ program called inventory.cpp as described below. Documentation is required; see next page. Write an interactive program for processing inventory information for a parts warehouse. When started, the program should read in from a text file used for storing information between sessions. It is possible that the text file is empty. The program user is then given five choices in the main menu: enter a new part to the system, find and print data for a part when given the part ID number, find and modify data for a part when given the part ID number, copy all information to a binary archive file, and quit. These choices will be explained more fully below While the program is running, all parts information should be in the main memory for fast response. You may assume that there will always be enough space in memory to do this Specifications: For each part, you need to store its ID (an integer), a short text description, its price, and a count of how many of that part the warehouse currently has. You are given two files Part.h and Part.cpp that hold the declarations and definitions for a simple Part class that holds just the ID, and the text description. You can revise the files as needed for this assignment. When the program first starts, it reads in the information is stored in a text file called textSave.txt. You may assume that such a file always exists, but may be empty The program should now print a menu and ask the user to enter one of the following letters corresponding to the 4 choices below. The program will do the appropriate task, and keep repeating (get choice, do task) until the option Q is chosen, N: this stands for a new part. The program should ask the user to enter the part ID and the rest of the part information. The program will then enter the new part information into the system F: this stands for finding a particular part. The program will ask for a part ID number, and search the system for a part with that ID. If it is found, the program will display the ID and all other information about the part to the screen. If it is not found, the program will print a message to the screen, telling the user that it could not be found A: This stands for archiving the information. Everything is output to a binary file called binarySave.dat Any previous file of that name will be overwrittern Q: this stands for quit. The program will write all the current parts information into the text file textSave.txt, overwriting any previous data before quittingExplanation / Answer
#include #include #include #include #include #include #include #include #include fstream inoutfile; //Menu Global Item#define pixTOrc(x) (8*(x-1)) //convert pixel into row and col format#define INC 5 //Increment Distance Between Menu Items#define ROW 15 //Row Value for Menu Item#define COL 8 //Column Value for Menu Item// To display the Inventory Main menu options typedef char option[15]; option mainMenu[]= { "New Record", "Display", "Search", "Updation", "Deletion", "Analysis", "Exit" }; /*-------------------Inventory Class--------------------*/class Inventory{ char itemNo[2],itemName[20]; int qty; double price,amt; public: char *getno(){return itemNo;} char *getitem(){ return itemName;} double getamt(){return amt;} void getdata(); void showdata(int,int); void showspecific(); void alterspecific(char *,char *); }; void Inventory :: getdata(){ gotoxy(30,12); coutitemNo; gotoxy(30,14); coutitemName; gotoxy(30,16); coutqty; gotoxy(30,18); coutprice; amt = price * qty; } void Inventory :: showdata(int x,int y){ gotoxy(x,y); cout.setf(ios::left,ios::adjustfield); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.