Answered Essay: 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 ( …)

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;

}

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

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.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?