Object Oriented Programming Project Report
Object Oriented Programming Project Report
project report
Group members
MADHIRE PAVITHRA(2020IMT-052)
PAMBA VAMSHI KRISHNA(2020IMT-066)
PRINCE MANN(2020IMT-073)
PRITHVI SINGH DANGAS(2020IMT-074)
SHRIYANSHU SHRIVASTAVA(2020IMT-096)
We affirm that no portion of our work is plagiarized, and the experiments and
results reported in the report/dissertation/thesis are not manipulated. In the
event of a com- plaint of plagiarism and the manipulation of the experiments and
results, we shall be fully responsible and answerable. Our faculty supervisor(s) will
not be responsible for the same.
Signature:
Madhire Pavithra(2020IMT-052)
Pamba Vamshi Krishna(2020IMT-066)
Prince Mann(2020IMT-073)
Prithvi Singh Dangas(2020IMT-074)
Shriyanshu Shrivastava(2020IMT-096)
Abstract
❖ Below are the classes and data members we used in our project
❖ Id_authentication()
❖ Book_issue()
❖ Book_availability()
❖ Fine_and_payment()
❖ Request_to_vendor()
❖ Request()
❖ Complaints()
❖Source code
❖Output
Source code:
#include<iostream>
#include<conio.h>
#include<string>
class Book {
private:
string isbn_no;//private variable
string topic;//private variable
string writer;//private variable
string version;//private variable
string publisher; //private variable
public:
//setters - these will assign user value tp private members
void setisbn_no(string a)
{
isbn_no = a;
}
void settopic(string b)
{
topic = b;
}
void setwriter(string c)
{
writer = c;
}
void setversion(string d)
{
version = d;
}
void setpublisher(string e)
{
publisher = e;
}
//getters - it gets the value from private members
string getisbn_no()
{
return isbn_no;
}
string gettopic()
{
return topic;
}
string getwriter()
{
return writer;
}
string getversion()
{
return version;
}
string getpublisher()
{
return publisher;
}
};
//main function
int main(){
string choice;
//Main Menu
system("cls");
cout<<"[1]add book\n";
cout<<"[2]delete book\n";
cout<<"[3]edit book\n";
cout<<"[4]search book\n";
getline(cin,choice);
system("cls");
if(choice=="1"){
addBook(counter); //function call
}
else if(choice=="2"){
deleteBook(counter); //function call
}
else if(choice=="3"){
editBook(counter); //function call
}
else if(choice=="4"){
searchBook(counter); //function call
}
else if(choice=="5"){
viewAllBooks(counter); //function call
}
else if(choice=="6"){
quit(); //function call
}
else{
main(); //function call to self(main)
}
_getch();
return 0;
}
//addBook function
void addBook(int counter){
string isbn_no,topic,writer,version,publisher;
cout<<"add book\n\n";
if(counter<10){
cout<<"enter isbn_no: ";
getline(cin,isbn_no); //getline - just like cin but includes white
spaces
books[counter].settopic(topic);
books[counter].setwriter(writer);
books[counter].setversion(version);
books[counter].setpublisher(publisher);
increment(counter); //function called for increment
counter
//deleteBook function
for(int i=0;i<counter;i++)
{
//finding a match using for loop
if(books[i].getisbn_no()==isbn_no){
cout<<"\nbook have been found\n\n";
cout<<"do you want to delete
this?\n[1]Yes\n[2]No\n\nEnter theChoice: ";
cin>>choice;
if(choice==1){
books[i].setisbn_no(""); //setting the value to
none
books[i].settopic("");
books[i].setwriter("");
books[i].setversion("");
books[i].setpublisher("");
for(int a=i;a<counter;a++){
// adjust the values upon deletion
books[a] = books[a+1];
}
books[9].setisbn_no(""); //adjustment if the
library is full(10 books)
books[9].settopic("");
books[9].setwriter("");
books[9].setversion("");
books[9].setpublisher("");
decrement(counter); //function called for
decrement counter
cout<<"\nBOOK HAS BEEN SUCCESSFULLY
DELETED!\n\nPress any key to continue";
_getch();
main();
}
else{
main();
}
}
}
cout<<"\nbook not found!\n\nPress any key to continue . . .";
_getch();
main();
}
void editBook(int counter){
system("cls");
string editisbn_no,choice;
string isbn_no,topic,writer,version,publisher;
cout<<"\nedit book\n\n";
if(counter==0){
cout<<"there is noy any book to edit!\n\nPress any key to
continue . . .";
_getch();
main();
}
cout<<"enter isbn_no: ";
getline(cin,editisbn_no);
for(int i=0;i<counter;i++){
//finding a match using for loop
if(books[i].getisbn_no()==editisbn_no){
cout<<"\nbook found!\n\n";
cout<<"isbn_no: "<<books[i].getisbn_no()<<endl;
cout<<"topic: "<<books[i].gettopic()<<endl;
cout<<"writer: "<<books[i].getwriter()<<endl;
cout<<"version: "<<books[i].getversion()<<endl;
cout<<"publisher: "<<books[i].getpublisher()<<endl;
cout<<"\ndo you want to edit?\n[1]Yes\n[2]No\n\n
Please Enter the choice: ";
getline(cin,choice);
if(choice=="1"){
//reenter the values
cout<<"enter isbn_no: ";
getline(cin,isbn_no);
cout<<"enter topic: ";
getline(cin,topic);
cout<<"enter writer: ";
getline(cin,writer);
cout<<"enter version: ";
getline(cin,version);
cout<<"enter publisher: ";
getline(cin,publisher);
books[i].setisbn_no(isbn_no);
books[i].settopic(topic);
books[i].setwriter(writer);
books[i].setversion(version);
books[i].setpublisher(publisher);
cout<<"\nbook has been edited
successfully!\n\nPress any key to continue . . .";
_getch();
editBook(counter);//function call to self
}
else{
main();
}
}
}
cout<<"\nbook not found!\n\nPress any key to continue . . .";
_getch();
main();
}
void searchBook(int counter){
string isbn_no;
int choice;
bool print = false; //boolean expression tosee which to print and
which to not
cout<<"search book\n\n";
if(counter==0){
cout<<"there is not any book to be searched!\n\nPress any key
to continue . . .";
_getch();
main();
}
cout<<"enter isbn_no: ";
getline(cin,isbn_no);
for(int i=0;i<counter;i++){
//finding a match using for loop
if(books[i].getisbn_no()==isbn_no){
cout<<"\nbook found!\n\n";
cout<<"isbn_no: "<<books[i].getisbn_no()<<endl;
cout<<"topic: "<<books[i].gettopic()<<endl;
cout<<"writer: "<<books[i].getwriter()<<endl;
cout<<"version: "<<books[i].getversion()<<endl;
cout<<"publisher: "<<books[i].getpublisher()<<endl;
print = true;
}
}
if(print){
cout<<"\n\nPress any key to continue ";
_getch();
main();
}
//if there's no book found
else{
cout<<"\nBOOK HAS NOT BEEN FOUND!\n\n please press any
of the key to continue . . .";
_getch();
main();
}
}
void viewAllBooks(int counter){
// using book array iterating the values on the library
cout<<"viewing all the books\n\n";
for(int i=0;i<counter;i++){
cout<<"details of the books\n\n";
cout<<"isbn_no: "<<books[i].getisbn_no()<<endl;
cout<<"topic: "<<books[i].gettopic()<<endl;
cout<<"writer: "<<books[i].getwriter()<<endl;
cout<<"version: "<<books[i].getversion()<<endl;
cout<<"publisher: "<<books[i].getpublisher()<<endl<<endl;
}
cout<<"Press any key to continue . . .";
_getch();
main();
}
void quit(){
//quit function
_exit(1);
}
Output:
You will be having 6 choices , you can choose any one of the choice.
If you enter your choice as 1
You can add a book as shown below
If you enter your choice again as 1 you can add a book again as shown below
If you enter your choice as 2
You can delete a book which you have added
You can see the below slide
You can delete your book successfully.
If you enter your choice as 3
You can edit your book which you have added
You can see below slide
Your book has been successfully edited!
If you choose your option as 4
You can search your all added books
You can see the following slide
If you enter your option as 5
You can view all added books
You can see the below slide
At last
If you enter your choice as 6
You can exit out from the program.