Question & Answer: I need help with the following C++ program:…..

I need help with the following C++ program:

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 overwritten. 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 quitting. Design considerations: You do not need to be concerned with speed when reading from or writing to the files. However, you should try to make the other tasks run quickly. You may choose any format for the two save files, as long as they contain all the information and can be read and written by your program as text (for textSave.txt) and written as binary (for binarySave.dat). Resources: In addition to the two files Part.h and Part.cpp, you are given files containing templates for a Stack class, a Queue class, and a Tree class (this implements a binary search tree). For each of the three data structures, you are also provided with a test program. All function bodies are given. You may use none, any, or all of them if it will help you. You are also free to revise any of these files if you wish. You should rename your file inventory.cpp and turn it in through the class Titanium site. Remember to put in your name and ID at the start of the file. 7 Please also turn in all additional files, old, new, or revised, that your program uses, to the file names. Required documentation: Your name and ID at the top for each file you write or revise. Pseudocode for your inventory.cpp. This can be turned in as a separate file (Word or plain text) or as a long comment at the beginning of the C++ file. If any variable name does not make it immediately clear what its role is, that variable must have documentation whenever it is used. All functions, including the main, must have a brief documentation that states what the function does, and the roles played by each of the parameters, if any. Other documentation is optional. Any unusual or tricky code should be documented, but please do not just repeat the code. For example, you do not need to say “for loop” because the code will say “for ( …)

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: I need help with the following C++ program:…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

Expert Answer

 

#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include “part.cpp”

int main()
{
char t;
Part p;
fstream testfile;
top:
clrscr();
cout<<“Press N: for enter new partn”;
cout<<“Press F: for Finding partn”;
cout<<“Press A: for Archive to binaryn”;
cout<<“Press Q: for enter new partn”;
cin>>t;
switch(t)
{
case ‘N’:
case ‘n’:
if (!testfile)
{
cout << “Error opening file, creating a new filen”;
testfile.open(“textSave.txt”, ios::out);
}
else
testfile.open(“textSave.txt”, ios::app);
p.getPart();
testfile.write((char *)&p,sizeof(p));
testfile.close();
goto top;
case ‘f’:
case ‘F’:
int pid,t=0;
cout<<“Please Enter part Id “;
cin>>pid;
testfile.open(“textSave.txt”, ios::in);
while(testfile.read((char *)&p,sizeof(p)))
{
if(p.ID==pid)
{
t++;
break;
}
}
if(t==1)
{
cout<<“Item Foundn”;
p.print();
}
else
cout<<“No Item Foundn”;
getch();
testfile.close();
goto top;
case ‘a’:
case ‘A’:
testfile.open(“textSave.txt”, ios::in);
ofstream testbin;
testbin.open(“binarysave.dat”,ios::out|ios::binary);
while(testfile.read((char *)&p,sizeof(p)))
{
testbin.write((char *)&p,sizeof(p));
}
goto top;
case ‘q’:
case ‘Q’:
break;
}
return 0;

}

Grand Paper Writers
Order NOW For A 10% Discount!
Pages (550 words)
Approximate price: -

Our Advantages

Plagiarism Free Papers

All papers are written by the best professional writers to ensure 100% originality. We always provide plagiarism reports whenever we deliver completed papers.

Free Revisions

All papers by Grand Paper Writers are completed and submitted on time. This timely delivery of papers gives you time to go through the paper before the official deadline.

Title-page

As an additional service, we will provide a title page that precedes the contents of your paper. Here, you will provide your personal details.

Bibliography

We also ensure that we provide an extra page for the references or bibliographies following referencing rules.

Originality & Security

At Grandpaperwriters.com, we guarantee students for the provision of security and original work. All your personal information is handled with confidentiality and is not shared with third parties. Additionally, we ensure that we provide original content with accompanying plagiarism reports to show originality.

24/7 Customer Support

Our customer support team is always available 24/7 to provide instant responses to any queries raised by students.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

Grandpaperwriters.com has the best professional essay writers for quality services.

Pricing

Flexible Pricing

Here, a Grandpaperwriters.com, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.

Communication

Admission Help & Client-Writer Contact

Grandpaperwriters.com provides an interactive portal where students can communicate directly to their writers.

Deadlines

Paper Submission

Here, a Grandpaperwriters.com, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.

Reviews

Customer Feedback

Grandpaperwriters.com appreciates feedback from our clients to help us improve the delivery of essay writing services. As such, we are constantly changing our policies to ensure maximum customer and writer satisfaction.