Write a C++ program to implement inheritance by accessing the base class constructor in the derived classes. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. The class Event has the following protected attributes

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a C++ program to implement inheritance by accessing the base class constructor in the derived classes.

Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.

The class Event has the following protected attributes

Data type Variable
string     name
string     detail
string     type
string     organiser 

  
Define the mentioned protected attributes in the Event class.

Define default constructor and a constructor with parameters passed in the same order as declared in the class and include appropriate getters and setters.

The derived class Exhibition derived from Event class has the following private attributes

Data type Variable
int     numberOfStalls


Define the mentioned private attribute in the Exhibition class.

Define default constructor and a constructor with parameters passed in the same order given below
Exhibition(String name, String detail, String type, String organiser, Integer numberOfStalls) and include appropriate getters and setters.

Include the following public member function in the class Exhibition

Method name Description
void display() This method displays the details of the Exhibition


 The derived class StageEvent derived from the Event class has the following private attributes

Data type Variable
int  numberOfSeats


Define the mentioned private attribute in the StageEvent class.

Define default constructor and a constructor with parameters passed in the same order given below
StageEvent(String name, String detail, String type, String organiser, Integer numberOfSeats) and include appropriate getters and setters.

Include the following public member function in the class StageEvent

Method name Description
void display() This method displays the details of the StageEvent


In the Main method, inputs from the user are obtained and the objects for StageEvent or Exhibition class are created and invoked display methods to display the details.

Input and Output format:
Refer sample input and output for formatting specifications.

Sample Input and Output 1
Choose Event type                                                                                                     
1.Exhibition                                                                                                          
2.Stage Event                                                                                                     
1                                                                                                                     
Enter the details of Exhibition in CSV format                                                                         
BookExpo,SpecialSale,Academics,John,12                                                                     
Name : BookExpo                                                                                                       
Detail : SpecialSale                                                                                                  
Type : Academics                                                                                                      
Organiser : John                                                                                                      
Number of Stalls : 12

Sample Input and Output 2:
Choose Event type                                                                                                     
1.Exhibition                                                                                                          
2.Stage Event                                                                                                         
2                                                                                                                     
Enter the details of Stage Event in CSV format                                                                      
MagicalShow,NewYearSpecial,Magic,Robert,55                                                                
Name : MagicalShow                                                                                                    
Detail : NewYearSpecial                                                                                               
Type : Magic                                                                                                          
Organiser : Robert                                                                                                    
Number of Seats : 55      

Sample Input and Output 3:
Choose Event type                                                                                                 
1.Exhibition                                                                                                      
2.Stage Event                                                                                                     
3                                                                                                                 
Invalid choice

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 7 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY