Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help out with this practice question, thank you! You are required to write a C++ program that creates a class with the following details:

Please help out with this practice question, thank you!

image text in transcribedimage text in transcribed
You are required to write a C++ program that creates a class with the following details: 0 A Cd class (Parent class): 0 private: l const char * performers; l const char * label; I int selections; I double playtime; l private Data Members 0 A default Constructor that makes performers and label to point to a heap memory location of 8 char and assign them both the initial value of "Unknown". The default constructor also assigns the initial value of O and 0.0 to selections and playtime respectively. 0 A parameterized constructor that has the signature CdCconst char * performers, const char * label, int selections, double playtime) and makes performers point to a heap memory location with a (size + 1) of performers variable from the parameter. You can get the size of the char array using strlen available in the library. Do the same for label as well except you should get the size of label from the parameter variable. Set selections and playtime to their corresponding values from the parameters. 0 Create a vi rtual void Report() method that displays the values of performers, label, selections and play time. (See output below for more information). 0 Make sure to write appropriate destructor for clearing up the heap memory. 0 A Classic class (child class): 0 private: l const char * primaryWork; O A default Constructor that makes primaryWork to point to a heap memory location of 8 char and assign it to an initial value of "Unknown". 0 A parameterized constructor that has the signature ClassicCconst char* primaryWork, const char* performers, const char* label, int selections, double playtime) and maps to the parameterized constructor of Cd class. It makes primaryWork point to a heap memory location with a (size + 1) of primaryWork variable from the parameter. You can get the size of the char array using strlen available in library. 0 Create a vi rtual void Report() method that displays the values of primaryWork. (See output below for more information). 0 Make sure to write appropriate destructor for clearing up the heap memory. . Use this main method to run the program. Please follow the comments in the main method to complete it to show output like that provided below: Using object directly: Performer(s) : Beatles Label: Capitol Number of selections: 14 Play time: 35.5 Primary work: Piano Sonata in B flat, Fantasia in C Performer(s): Alfred Brendel Label: Philips Number of selections: 2 Play time: 57.17 Using type cd * pointer to objects: Performer(s) : Beatles Label: Capitol Number of selections: 14 Play time: 35.5 Primary work: Piano Sonata in B flat, Fantasia in C Performer(s) : Alfred Brendel Label: Philips Number of selections: 2 Play time: 57.17 C: \\Users\\Razi\\Documents\\Visual Studio 2019\\CSCI 10610\\Lab 6\\Debug\\Lab 6. exe (process 16940) exited with code -1. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the conso le when debugging stops. Press any key to close this window

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_2

Step: 3

blur-text-image_3

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

In Texas justice of the peace courts handle, which kind of disputes

Answered: 1 week ago