Question

In: Computer Science

Store owners need an application that allows them to determine which books and movies they have...

Store owners need an application that allows them to determine which books and movies they have rented. The application should save the general information of the borrowed items. The information of the book is: title, classification (genre), the number of pages and the author. The information in the second article is: title, duration, director and type of film.
Do the necessary classes to represent the two articles. Each object in the classes must provide the following services:
to show
ask
obtain
change
compare if two borrowed items are equal
1.All / part
2.Overloading of operators
3.Builder
4.Copy constructor
5.Destroyer
6. Dynamic memory

C++

Solutions

Expert Solution

//C++ CODE TO COPY FOR BOOK RECORD (ARTICLE#1)//

//used header files
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;

//book class will keep all book record
class Book
{
public:
   string title;
   string genre;
   int no_of_pages;
   string author;

   Book *link;
   void set_id(int no_of_pages)
   {
       this->no_of_pages = no_of_pages;
   }
   void set_title(string title)
   {
       this->title = title;
   }
   void set_genre(string genre)
   {
       this->genre = genre;
   }
   void set_author(string author)
   {
       this->author = author;
   }

   int get_no_of_pages()
   {
       return no_of_pages;
   }
   string get_title()
   {
       return title;
   }
   string get_genre()
   {
       return genre;
   }
   string get_author()
   {
       return author;
   }

};

Book *head = NULL;

void add()
{
   system("cls");
string name;
   string qualification;
   Book *p = new Book();
   cout << "Enter Book no_of_pages: ";
   cin >> p->no_of_pages;
   cout << "\nEnter Book Title: ";
   cin >> p->title;
   cout << "\nEnter Book Genre: ";
   cin >> p->genre;
   cout << "\nEnter Author Name: ";
   cin >> p->author;
   p->link = NULL;
   if (head == NULL)
       head = p;
   else
   {
       Book *a = head;
       while (a->link != NULL)
       {
           a = a->link;
       }
       a->link = p;
   }
}

void Remove()
{
   int n = 0;
   int n1 = 0;
   int no_of_pages;
   cout << "\nEnter no_of_pages to Remove Book Record: ";
   cin >> no_of_pages;
   Book *p = head;
   Book *p1 = head;
   if (p->link == NULL)
   {
       if (p->get_no_of_pages() == no_of_pages)
           delete p;
       head = NULL;
   }
   else{

       while (p != NULL)
       {


           if (p1->get_no_of_pages() == no_of_pages)
           {

               goto no;

           }
           if (n<n1)
           {
               p = p->link;
           }
           p1 = p1->link;
           n1++;
       }
   no:
       Book *temp = p1->link;
       delete p1;
       p->link = temp;
   }


}

void display()
{
   int n = 0;
   Book *p = head;
   if (head == NULL)
       cout << "\nList is Empty!";
   while (p != NULL)
   {

       cout << p->get_no_of_pages() << " ";
       cout << p->get_title() << " ";
       cout << p->get_genre() << " ";
       cout << p->get_author() << " ";
       cout << endl;
       p = p->link;
   }


}

void search()
{
   int check = 0;
   string name;
   cout << "\nEnter Book title to Search From List: ";
   cin >> name;
   Book *p = head;
   while (p != NULL)
   {
       if (p->get_title().compare(name)==0)
       {
           check++;
           goto show;

       }
       p = p->link;
   }
show:
   if (check == 0)
       cout << "\nOpps Record Not Found!";
   else
       cout << "Recorde Found!\nNo of pages: " << p->get_no_of_pages() << "\nTitle: " << p->get_title()
       << "\nGenre: " << p->get_genre() << "\nAuthor Name: " << p->get_author();
}

void count()
{
   Book *p = head;
   int count = 0;
   while (p != NULL)
   {
       count++;
       p = p->link;
   }
   cout << "\nCounted Data Items: " << count;
}

void update()
{
   int choice;
   string namee;
   string exp;
   string qua;
   int check = 0;
   cout << "\nEnter Book Title to Perform Updation: ";
   cin >> namee;
   Book *p = head;
   while (p != NULL)
   {
       if (p->get_title().compare(namee)==0)
       {
           check++;
           goto update;
       }
       p = p->link;
   }
update:
   if (check == 0)
       cout << "Opps Book Could Not Found!";
   else
   {
   again:
       system("cls");
       cout << "\n1.Update_Title\n2.Update_Genre\n3.Update_Author\n4.Done\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           cout << "\nEnter Existing Title: ";
           cin >> namee;
           if (p->get_title().compare(namee)==0)
           {
               cout << "\nEnter New Name: ";
               cin >> namee;
               p->set_title(namee);
               cout << "\nTitle Entered Successfuly!";
               _getche();
               goto again;
           }
           else
           {
               cout << "\nEntered Title Does Not Match!";
               goto again;
           }
       }
       else if (choice == 2)
       {
           cout << "\nEnter New Genre: ";
           cin >> exp;
           p->set_genre(exp);
           cout << "\nNew Genre Entered Successfuly!";
           _getche();
           goto again;
       }
       else if (choice == 3)
       {
           cout << "\nEnter New Author Name: ";
           cin >> qua;
           p->set_author(qua);
           cout << "\nNew Author Name Entered Successfuly!";
           _getche();
           goto again;
       }
       else if (choice == 4)
       {
           return;
       }
   }
}
int main()
{
menue:
   system("cls");
   int choice = 0;
   cout << "\t\t\tWELCOME TO BOOK RECORD MANAGEMENT SYSTEM TOOL\n\n1.Add_Book Record"
   <<"\n2.Remove_Book Record\n3.Display_Book Record\n4.Search_Book Record\n5.Count_borrowed Books\n6.Update_Book Information"
   <<"\n\n\nSelect Your Choice : ";
   cin >> choice;
   switch (choice)
   {
   case 1:
       add();
       system("cls");
       cout << "\nRecorde Added Successfuly!" << endl;
       cout << "\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 2:
       Remove();
       system("cls");
       cout << "\nRecorde Removed Successfuly!" << endl;
       cout << "\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 3:
       system("cls");
       display();
       cout << "\n\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           goto menue;
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 4:
       system("cls");
       search();
       cout << "\n\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           goto menue;
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 5:
       system("cls");
       count();
       cout << "\n\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           goto menue;
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 6:
       system("cls");
       update();
       cout << "\n\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           goto menue;
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   default:
       cout << "\nInvalid Input!";
   }
}

//OUTPUT//

//--------------------------------------------------------------------------------------------------------------------------------------------------//

//C++ CODE TO COPY FOR FILM RECORD (ARTICLE#2)//

//used header files
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;

//Film class will keep all Film record
class Film
{
public:
   string title;
   int duration;
   string director;
   string type_of_film;

   Film *link;
   void set_duration(int duration)
   {
       this->duration = duration;
   }
   void set_title(string title)
   {
       this->title = title;
   }
   void set_type_of_film(string type_of_film)
   {
       this->type_of_film = type_of_film;
   }
   void set_director(string director)
   {
       this->director = director;
   }

   int get_duration()
   {
       return duration;
   }
   string get_title()
   {
       return title;
   }
   string get_type_of_film()
   {
       return type_of_film;
   }
   string get_director()
   {
       return director;
   }

};

Film *head = NULL;

void add()
{
   system("cls");
string name;
   string qualification;
   Film *p = new Film();
   cout << "Enter Film duration: ";
   cin >> p->duration;
   cout << "\nEnter Film Title: ";
   cin >> p->title;
   cout << "\nEnter Film type_of_film: ";
   cin >> p->type_of_film;
   cout << "\nEnter director Name: ";
   cin >> p->director;
   p->link = NULL;
   if (head == NULL)
       head = p;
   else
   {
       Film *a = head;
       while (a->link != NULL)
       {
           a = a->link;
       }
       a->link = p;
   }
}

void Remove()
{
   int n = 0;
   int n1 = 0;
   int duration;
   cout << "\nEnter duration to Remove Film Record: ";
   cin >> duration;
   Film *p = head;
   Film *p1 = head;
   if (p->link == NULL)
   {
       if (p->get_duration() == duration)
           delete p;
       head = NULL;
   }
   else{

       while (p != NULL)
       {


           if (p1->get_duration() == duration)
           {

               goto no;

           }
           if (n<n1)
           {
               p = p->link;
           }
           p1 = p1->link;
           n1++;
       }
   no:
       Film *temp = p1->link;
       delete p1;
       p->link = temp;
   }


}

void display()
{
   int n = 0;
   Film *p = head;
   if (head == NULL)
       cout << "\nList is Empty!";
   while (p != NULL)
   {

       cout << p->get_duration() << " ";
       cout << p->get_title() << " ";
       cout << p->get_type_of_film() << " ";
       cout << p->get_director() << " ";
       cout << endl;
       p = p->link;
   }


}

void search()
{
   int check = 0;
   string name;
   cout << "\nEnter Film title to Search From List: ";
   cin >> name;
   Film *p = head;
   while (p != NULL)
   {
       if (p->get_title().compare(name)==0)
       {
           check++;
           goto show;

       }
       p = p->link;
   }
show:
   if (check == 0)
       cout << "\nOpps Record Not Found!";
   else
       cout << "Recorde Found!\nNo of pages: " << p->get_duration() << "\nTitle: " << p->get_title()
       << "\ntype_of_film: " << p->get_type_of_film() << "\ndirector Name: " << p->get_director();
}

void count()
{
   Film *p = head;
   int count = 0;
   while (p != NULL)
   {
       count++;
       p = p->link;
   }
   cout << "\nCounted Data Items: " << count;
}

void update()
{
   int choice;
   string namee;
   string exp;
   string qua;
   int check = 0;
   cout << "\nEnter Film Title to Perform Updation: ";
   cin >> namee;
   Film *p = head;
   while (p != NULL)
   {
       if (p->get_title().compare(namee)==0)
       {
           check++;
           goto update;
       }
       p = p->link;
   }
update:
   if (check == 0)
       cout << "Opps Film Could Not Found!";
   else
   {
   again:
       system("cls");
       cout << "\n1.Update_Title\n2.Update_type_of_film\n3.Update_director\n4.Done\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           cout << "\nEnter Existing Title: ";
           cin >> namee;
           if (p->get_title().compare(namee)==0)
           {
               cout << "\nEnter New Name: ";
               cin >> namee;
               p->set_title(namee);
               cout << "\nTitle Entered Successfuly!";
               _getche();
               goto again;
           }
           else
           {
               cout << "\nEntered Title Does Not Match!";
               goto again;
           }
       }
       else if (choice == 2)
       {
           cout << "\nEnter New type_of_film: ";
           cin >> exp;
           p->set_type_of_film(exp);
           cout << "\nNew type_of_film Entered Successfuly!";
           _getche();
           goto again;
       }
       else if (choice == 3)
       {
           cout << "\nEnter New director Name: ";
           cin >> qua;
           p->set_director(qua);
           cout << "\nNew director Name Entered Successfuly!";
           _getche();
           goto again;
       }
       else if (choice == 4)
       {
           return;
       }
   }
}
int main()
{
menue:
   system("cls");
   int choice = 0;
   cout << "\t\t\tWELCOME TO Film RECORD MANAGEMENT SYSTEM TOOL\n\n1.Add_Film Record"
   <<"\n2.Remove_Film Record\n3.Display_Film Record\n4.Search_Film Record\n5.Count_borrowed Films\n6.Update_Film Information"
   <<"\n\n\nSelect Your Choice : ";
   cin >> choice;
   switch (choice)
   {
   case 1:
       add();
       system("cls");
       cout << "\nRecorde Added Successfuly!" << endl;
       cout << "\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 2:
       Remove();
       system("cls");
       cout << "\nRecorde Removed Successfuly!" << endl;
       cout << "\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 3:
       system("cls");
       display();
       cout << "\n\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           goto menue;
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 4:
       system("cls");
       search();
       cout << "\n\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           goto menue;
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 5:
       system("cls");
       count();
       cout << "\n\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           goto menue;
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   case 6:
       system("cls");
       update();
       cout << "\n\n1.Menue\n0.Exit\nSelect Your Choice: ";
       cin >> choice;
       if (choice == 1)
       {
           goto menue;
           system("cls");
           goto menue;
       }
       else
           return 0;
       break;
   default:
       cout << "\nInvalid Input!";
   }
}

Comment down for any queries!
Please give a thumbs up if you are satisfied and helped with the answer :)


Related Solutions

Create a C# application for Library that allows you to enter data for books and saves...
Create a C# application for Library that allows you to enter data for books and saves the data to a file named Books.txt. Create a Book class that contains fields for title, author, number of pages, and price of the book and ToString() method. The fields of records in the file are separated with asterisk (*). Expecting sentinel value for ending the process of writing to file is "000"
All mutiple choice I need all 3 please Water molecules have a polarity, which allows them...
All mutiple choice I need all 3 please Water molecules have a polarity, which allows them to be electrically attracted to other water molecules and other polar molecules by weak chemical bonds known as a. non polar covalent bonds b. hydrogen bonds c. polar covalent bonds d. ionic bonds e. none of the above Which type of bond must be broken for water to vaporize? a. ionic bonds b. polar covalent bonds c. hydrogen bonds d. both polar covalent bonds...
1. Governments may have a budget surplus, which allows them the flexibility to put money into...
1. Governments may have a budget surplus, which allows them the flexibility to put money into a(n) ______________ to be used when budget shortfalls occur. Investment Account Budget Reserve Slush Fund Holding Account 2. A cash flow problem occurs when the amount of revenue available is not sufficient to cover a media expenditure. Barring any unforeseen occurrences, cities do not tend to have a cash flow problem because they know when tax collections are due. True False 3. In the...
Develop a Java application which implements an application for a store chain that has three types...
Develop a Java application which implements an application for a store chain that has three types of stores which are Book, Music, and Movie stores. Your application should have an Item abstract class which should be extended by the Book and Multimedia classes. Item class has abstract priceAfterTax method, you need to implement this method in derived classes. Multimedia class is a superclass for Music and Movie classes. Your project should also include the IPromotion interface, which should be implemented...
A husband and wife claim that they have a special bond that allows them to communicate...
A husband and wife claim that they have a special bond that allows them to communicate by ESP. To test this claim, an researcher puts the husband and wife in separate rooms. The husband is randomly shown one of 5 colors: either blue, red, green, yellow or orange. He then is given 5 seconds to use his ESP to communicate the color to his wife. The wife then has to decide which of the 5 colors she was shown. This...
Summarize the unique properties of viruses and explain which of these characteristics allows them to function...
Summarize the unique properties of viruses and explain which of these characteristics allows them to function as a parasite
6. There are 40 books on a bookshelf. Exactly 10 of them have a red cover....
6. There are 40 books on a bookshelf. Exactly 10 of them have a red cover. The remaining books have a white cover. You intend to choose a random sample of nine books, but you haven't decided whether to choose with replacement or without replacement? a) If you choose books with our placement, would this procedure lead to independent trials or dependent trials? b)if you choose books with replacement, would this procedure be consistent with a binomial experiment or not?...
You have a patient who is severely dehydrated and you need to rehydrate them intravenously. Which...
You have a patient who is severely dehydrated and you need to rehydrate them intravenously. Which of the following solutions do you choose and why? For each solution describe why or why not you would choose it. Distilled H20 0.9% saline 5.0% saline
Write a program (C++) which allows a League of Legends player to both store and output...
Write a program (C++) which allows a League of Legends player to both store and output statistics on their games played. When the program starts it allows the user to enter new entries. The entries contain the following information: Champion Name Kills Assists Deaths Win? Each entry is appended to a file called games.txt. When the user is done entering data the statistics from the games in the file are to be displayed. The average kills, assists, and deaths are...
The owners have concluded that they need to know more about their customers and target market....
The owners have concluded that they need to know more about their customers and target market. To obtain a better understanding of each of these issues, they logged on to the Yahoo.com and Google.com search engines. They also spent some time examining trade literature. From this review of the literature, some "Best Practices" guidelines were found on how restaurants should be run. Below is a summary of what was found: If you do not have enough customers, first examine the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT