Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Should work in Visual Studio. Here, I need to create a Invetory for a bookst

ID: 3802139 • Letter: C

Question

C++

Should work in Visual Studio.

Here, I need to create a Invetory for a bookstore.

I should be able to list all the book with all the information and should be able to sort by date, name and price as mention above.

I should be able to create a list and replace the older file with the new one if wanted.

should be able to search the book and book location.

User input is from file and output should be in file as well.

Please, give me a full working program on C++ should run in VS.

For example.

1.

Name: mastermind

Author: Ogolo

price: 200

date: 06/28/2015

quantity: 20

2.

Name: nevermind

Author: shakespeare

price: 200

date: 08/28/1996

quantity: 15

database. The Report Module The Report module will analyze the information in the Inventory Database to produce any of the following reports: Inventory List. Alist of information on all books in the inventory. Inventory Wholesale Value. A list of the wholesale value of all books in the inventory and the total wholesale value of the inventory. Inventory Retail value. A list of the retail value of all books in the inventory and the total retail value of the inventory. List by Quantity. A list of all books in the inventory sorted by quantity on hand. he books with the greatest quantity on hand will be listed first. List by Cost. A list of all books in the inventory, sorted by wholesale cost. The books with the greatest wholesale cost will be listed first. List by Age. A list of all books in the inventory, sorted by purchase date. Th books that have been in the inventory longest will be listed first.

Explanation / Answer

#include<fstream.h>
#include<string.h>
#include<conio.h>
#include<iomanip.h>
#include<dos.h>


class book_store
{
public:

char code[20],b_name[30],w_name[30];
float price;

void get_data()
{
cout<<" Book name :";
cin>>b_name;

cout<<" Book code : ";
cin>>code;

cout<<" Writer name :";
cin>>w_name;

cout<<" Price :";
cin>>price;
cout<<endl;
};

};


class book_file:public book_store
{
public:
void fil()
{
fstream file("All_Books.txt",ios::out|ios::app);

file.width(20);
file<<setiosflags(ios::left);
file<<b_name;

file.width(20);
file<<setiosflags(ios::left);
file<<w_name;

file.width(10);
file<<setiosflags(ios::right);
file<<code;

file.width(10);
file<<setiosflags(ios::right);
file<<price<<endl;

file.close();
}
void file();

};
void book_file::file()
{
char fil[20];

get_data();
strcpy(fil,code);
strcat(fil,".txt");

ofstream file(fil);
file<<"Book Name :"<<b_name<<endl;
file<<"Writer Name :"<<w_name<<endl;
file<<"Book Code :"<<code<<endl;
file<<"Price :"<<price<<endl;
file.close();

}


class T1:public book_file
{
public:

void book_data()
{
fstream file1("Literature.txt",ios::out|ios::app);
file1<<endl;
file1<<"Book Name :"<<b_name<<endl;
file1<<"Writer Name :"<<w_name<<endl;
file1<<"Book Code :"<<code<<endl;
file1<<"Price :"<<price<<endl;
file1.close();
}
};


class T2:public book_file
{
public:

void book_data()
{
fstream file1("Philosophy.txt",ios::out|ios::app);
file1<<endl;
file1<<"Book Name :"<<b_name<<endl;
file1<<"Writer Name :"<<w_name<<endl;
file1<<"Book Code :"<<code<<endl;
file1<<"Price :"<<price<<endl;
file1.close();
}
};

class T3:public book_file
{
public:

void book_data()
{
fstream file1("Science.txt",ios::out|ios::app);
file1<<endl;
file1<<"Book Name :"<<b_name<<endl;
file1<<"Writer Name :"<<w_name<<endl;
file1<<"Book Code :"<<code<<endl;
file1<<"Price :"<<price<<endl;
file1.close();
}
};

class T4:public book_file
{
public:

void book_data()
{
fstream file1("Comics.txt",ios::out|ios::app);
file1<<endl;
file1<<"Book Name :"<<b_name<<endl;
file1<<"Writer Name :"<<w_name<<endl;
file1<<"Book Code :"<<code<<endl;
file1<<"Price :"<<price<<endl;
file1.close();
}
}; //T4 class ends


class add_books
{
public:
add_books();
};

add_books::add_books()

{

T1 t1;
T2 t2;
T3 t3;
T4 t4;
int choice;

while(1)
{
clrscr();
cout<<"....................Add Books................";
cout<<" 1.Literature Books 2.Philosophy books 3.Science Books 4.Comics books 5.Exit ";
cout<<" Choice:";
cin>>choice;

if(choice==1)
{
t1.file();
t1.book_data();
t1.fil();

}

if(choice==2)
{
t2.file();
t2.book_data();
t2.fil();

}

if(choice==3)
{
t3.file();
t3.book_data();
t3.fil();

}

if(choice==4)
{
t4.file();
t4.book_data();
t4.fil();

}

if(choice==5)
{
break;
}

} //while ends

} //add_books fn ends


class display
{
public:
display();
};


display::display()
{
int choice;
char code[10],ch;
while(1)
{
cout<<" ...................DISPLAY..................... ";
cout<<"1.All Books"<<endl;
cout<<"2.Literature"<<endl;
cout<<"3.Philosophy"<<endl;
cout<<"4.Science"<<endl;
cout<<"5.Comics"<<endl;
cout<<"6.Exit"<<endl;

//...................................................................
cout<<" Enter Ur Choice:" ;
cin>>choice;

if(choice==1)
{
clrscr();

cout<<endl;
cout.width(20);
cout<<setiosflags(ios::left);
cout<<"Book Name";

cout.width(20);
cout<<setiosflags(ios::left);
cout<<"Writer Name";

cout.width(10);
cout<<setiosflags(ios::right);
cout<<"Code";

cout.width(10);
cout<<setiosflags(ios::right);
cout<<"Price"<<endl<<endl;

fstream file("All_Books.txt",ios::in);
file.seekg(0);
while(file)
{
file.get(ch);
cout<<ch;
}
file.close();
getch();
}

if(choice==2)
{
clrscr();
fstream file("Literature.txt",ios::in);
file.seekg(0);
cout<<" ";
while(file)
{
file.get(ch);
delay(90);
cout<<ch;
}
file.close();
getch();
}

if(choice==3)
{
clrscr();
fstream file("Philosophy.txt",ios::in);
file.seekg(0);
cout<<" ";
while(file)
{
file.get(ch);
delay(90);
cout<<ch;
}
file.close();
getch();
}

if(choice==4)
{
clrscr();
fstream file("Science.txt",ios::in);
file.seekg(0);
cout<<" ";
while(file)
{
file.get(ch);
delay(90);
cout<<ch;
}
file.close();
getch();
}

if(choice==5)
{
clrscr();
fstream file("Comics.txt",ios::in);
file.seekg(0);
cout<<" ";
while(file)
{
file.get(ch);
delay(90);
cout<<ch;
}
file.close();
getch();
}

if(choice==6)
break;

} // while (choice) ends
} // display class ends


class search
{
public:
search();
};

search::search()
{
int choice;
char fil[20];
char ch,code[10];
while(1)
{
clrscr();
cout<<" ....................SEARCH................... ";
cout<<"1.Search";
cout<<" 2.Exit ";
cout<<" Chioce:";
cin>>choice;
if(choice==1)
{
cout<<"Enter Code:";
cin>>code;
cout<<endl;
strcpy(fil,code);
strcat(fil,".txt");
fstream file(fil,ios::in);
while(file)
{
file.get(ch);
cout<<ch;
}
file.close();
getch();
}
if(choice==2)
break;
}


}

class start
{
public:
start();
};

start::start()
{
int choice;
textcolor(114);
textbackground(0);
highvideo();
while(1)
{
clrscr();
cout<<" .........Enter Ur Choice........ ";
cout<<"1.Add Books ";
cout<<"2.Display ";
cout<<"3.Search ";
cout<<"4.Exit ";
cout<<"Choice:";
cin>>choice;

if(choice==1)
{ add_books a;}

if(choice==2)
{ display d;}

if(choice==3)
{search s; }

if(choice==4)
break;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote