Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ code Question 1: Use the class Novel to complete the following task. Implement Event class for selling novels as follows: 1. The member variables:

C++ code image text in transcribed
image text in transcribed
Question 1: Use the class Novel to complete the following task. Implement Event class for selling novels as follows: 1. The member variables: - event id: int. - event location: string. - number of novels: int. It is unknown and can vary from one event to another. - novels: Novel array, its size is the number of novels. 2. An Event class constructor that receives: event number and location. You have to use this pointer. 3. A member function void SetNovels( novels * n, int num_of_novels) which sets the novels for the event according to received array of novels. Note that this function can be used to change the novels as well. 4. A Destructor for Event Class. 5. copy constructor 6. A member function Get TotalPrice which returns the sum of all novels price in the same event. 7. A friend function removeNovelFromEvent(Event& currentEvent, int i): this function remove the ith novel from the array novels in the currentEvent object and shifts remaining Novels. i should be in a proper range. Note: you have to create new Novel array. 8. A friend function printDetails(Event& e) to print the details of the event. Question 2: write a main function consists of the following: 1. create an object of type Event called eventi. - event id: 1 - event location: Amman - number of novels: 3 - novels: fill the novels from the user 2. create an object of type novel called eventicopy, it is a copy of the object event1. Use the copy constructor. 3. call the function removeNovelFromEvent to remove the first element in the novels array of eventi. 4. call the printDetails function for the two objects

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions