Question

In: Computer Science

C++ language Using classes (OOD), design a system that will support lending various types of media...

C++ language

Using classes (OOD), design a system that will support lending various types of media starting with books. Program should be able to handle a maximum of 500 books. Program should meet at least the following requirements:

1. Define a base media class with a book class derived from it. (Specific class names determined by programmer.)

2. The classes should contain at least the following information: title, up to four authors, ISBN.

3. Define a collection class that will hold up to 500 books.

4. The program should be able to perform the following operations supported by the class definitions:

a) Load data from a drive

b)Sort and display the books by title

c)Sort and display the books by author

d)Add and remove books

Programming requirements: Must include examples of inheritance and composition

~~~Function/Class comments (Description, pre and post conditions)

~~~Internal comments for all functions

Solutions

Expert Solution

#include <iostream>

#include <cstring>

using namespace std;

class media

{

   protected:

      character title[50];

      float ISBN;

                              

   public:

      media( char * s, float a)

     {

         Strcpy(title, s);

         ISBN = a;

      }

      Virtual void display() {}

};

                              

class book: public media

{

int pages;

   public:

            book ( char * s, float a, int p) : media(s,a)

               {

               pages = p;

               }

               void display();

};

class dvd: public media

{

Float time;

   public:

            dvd ( char * s, float a, float t) : media(s,a)

               {

               time = t;

               }

               void display();

};

Void book :: display()

{

cout << “\n Title: “ << title;

cout << “\n Pages: “ << pages;

cout << “\n ISBN: “ << ISBN;

}

Void dvd :: display()

{

cout << “\n Title: “ << title;

cout << “\n Play time: “ << time;

cout << “\n Price: “ << price;

}

// Main function for the program

int main( )

{

Char * title = new char[30] ;

  Float price, time;

Int pages;

//Book Details

  cout << “\n Enter book details\n”;

cout << “ Title: “; cin>> title;

cout << “\n ISBN: “ <; cin>> ISBN;

cout << “\n Pages: “; cin>> pages;

book book1 (title, ISBN, pages);

//Dvd Details

  cout << “\n Enter dvd details\n”;

cout << “ Title: “; cin>> title;

cout << “\n Play time: “; cin>> time;

  cout << “\n Price: “ <; cin>> price;

tape tape1 (title, price, time);

media * list[2];

list[0] = &book1;

list[1] = &dvd1;

cout << “\n BOOK”;

list[0] -> display();

cout << “\n Dvd”;

list[1] -> display();

   return 0;

}


Related Solutions

Using C++. For this assignment you will design a set of classes that work together to...
Using C++. For this assignment you will design a set of classes that work together to simulate a police officer issuing a parking ticket. The classes you should design are : The ParkedCar class: This class should simulate a parked car. The class's responsibilities are: -to know the car's make, model,color ,license number,and the number of minutes that the car has been parked The ParkingMeter Class: This class should simulate a parking meter. the class's only responsibility is: -To know...
In this Question using c++, you are to develop an employee management system using classes. You...
In this Question using c++, you are to develop an employee management system using classes. You need to develop two classes: Date and Employee. The Date class has the three attributes (int): month, day, and year. The class has the following member functions: • string getDate(void): returns a string with the date information (e.g, Mach 27, 2020). In addition to these, declare and implement proper constructors, a copy constructor, a destructor, and getters and setters for all data members. The...
Need to design a program in C++ that plays hangman using classes (polymorphism and inheritance) Below...
Need to design a program in C++ that plays hangman using classes (polymorphism and inheritance) Below is the code only need to add the classes and make the program run with at least one class of Polymorphism and Inheritance. CODE: #include <iostream> #include <cstdlib> #include<ctime> #include <string> using namespace std; int NUM_TRY=8; //A classic Hangman game has 8 tries. You can change if you want. int checkGuess (char, string, string&); //function to check the guessed letter void main_menu(); string message...
The answer should be in JAVA. You will design and implement two classes to support a...
The answer should be in JAVA. You will design and implement two classes to support a client program, RockPaperScissorsGame.java, to simulate Rock-Paper-Scissors game. Read and understand the client program to find out the requirements for the HandShape and Player classes. The rules of the Rock-Paper-Scissors game are:     Scissors✌️ beats Paper✋ that beats Rock✊ that beats Scissors✌️ Additionally, to simplify the game logic (and complexify a little bit the HandSahpe class) , two players cannot show the same hand shape....
The answer should be in JAVA. You will design and implement two classes to support a...
The answer should be in JAVA. You will design and implement two classes to support a client program, RockPaperScissorsGame.java, to simulate Rock-Paper-Scissors game. Read and understand the client program to find out the requirements for the HandShape and Player classes. The rules of the Rock-Paper-Scissors game are:     Scissors✌️ beats Paper✋ that beats Rock✊ that beats Scissors✌️ Additionally, to simplify the game logic (and complexify a little bit the HandSahpe class) , two players cannot show the same hand shape....
Write a C++ program that will be an information system for Oregon State University using classes...
Write a C++ program that will be an information system for Oregon State University using classes as well as demonstrating a basic understanding of inheritance and polymorphism. You will create a representation of an Oregon State University information system that will contain information about the university. The university will contain a name of the university, n number of buildings, and m number of people. People can be either a student or an instructor. Every person will have a name and...
Write a C++ program that will be an information system for Oregon State University using classes...
Write a C++ program that will be an information system for Oregon State University using classes as well as demonstrating a basic understanding of inheritance and polymorphism. You will create a representation of an Oregon State University information system that will contain information about the university. The university will contain a name of the university, n number of buildings, and m number of people. People can be either a student or an instructor. Every person will have a name and...
Design a memory management scheme for a 48 bit architecture, using various types of paging and/or...
Design a memory management scheme for a 48 bit architecture, using various types of paging and/or segmentation. You should include a clear translation scheme from a 48 bit logical address to a 48 bit physical address including a picture that shows this translation procedure. Then highlight its advantages and disadvantages.
In elementary school, how might you support the development of media literacy in your classes?
In elementary school, how might you support the development of media literacy in your classes?
Create a C++ code for the mastermind game using classes(private classes and public classes). Using this...
Create a C++ code for the mastermind game using classes(private classes and public classes). Using this uml as a reference.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT