Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 16, Problem 11PC
Inheritance Modification
Assuming you have completed
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Make Album in c++
You are going to develop a new class named Album. This class will has (at a minimum) teh following attributes and features:
Attributes:
Album Title
Artist Name
Array of song names (Track Listing)
Array of track lengths (decide on a unit)
At most there can be 20 songs on an album.
Behaviors:
Default and at least one argumented constructor
Appropriate getters for attributes
bool addTrack(string name, type duration) - adds track to album. You decide type on duration. Make sure you document what dis is.
getAlbumLength() - method dat returns total length of album matching watever units / type you decide.
getAlbumLength_string() - method dat returns total length of album in mm:ss format string. I would suggest using you're other getLength function here.
string shuffleAlbum(int n) - method dat returns a formatted string made up of n random tracks from teh album.
The string will be in the format [1] track_name (mm:ss), [2] track_name (mm:ss)...
Well formatted print()…
Make Album in c++
You are going to develop a new class named Album. This class will has (at a minimum) teh following attributes and features:
Attributes:
Album Title
Artist Name
Array of song names (Track Listing)
Array of track lengths (decide on a unit)
At most there can be 20 songs on an album.
Behaviors:
Default and at least one argumented constructor
Appropriate getters for attributes
bool addTrack(string name, type duration) - adds track to album. You decide type on duration. Make sure you document what dis is.
getAlbumLength() - method dat returns total length of album matching watever units / type you decide.
getAlbumLength_string() - method dat returns total length of album in mm:ss format string. I would suggest using you're other getLength function here.
string shuffleAlbum(int n) - method dat returns a formatted string made up of n random tracks from teh album.
The string will be in the format [1] track_name (mm:ss), [2] track_name (mm:ss)...
Well formatted print()…
Animal Lab
The objective of this assignment is to give you some practice using inheritance, virtual functions, and polymorphism.
Instructions:
Create a base class called Animal. All animals have a name (i.e. “Fido,” “Thumper,” “Princess,” “Nemo,” etc.) and an age. Provide a default constructor that initializes the age to zero and outputs the message “Invoking the default Animal constructor” and another constructor that allows the name and age to be set by the client. This other constructor should also output the message “Invoking the 2-argument Animal constructor.” Also construct a destructor for this class that outputs the message “Invoking the default Animal destructor.” Your Animal class should have a function called Move that cannot be implemented. That is, it should be declared as a purely virtual function. Your class should also have Get and Set methods to allow the name and age to be accessed.
From the Animal class, derive Dog, Rabbit, Fish, and Snake classes. The derived…
Chapter 16 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Ch. 16.1 - Prob. 16.1CPCh. 16.1 - Prob. 16.2CPCh. 16.1 - Prob. 16.3CPCh. 16.1 - Prob. 16.4CPCh. 16.1 - Prob. 16.5CPCh. 16.3 - Prob. 16.6CPCh. 16.3 - The following function accepts an i nt argument...Ch. 16.3 - Prob. 16.8CPCh. 16.3 - Prob. 16.9CPCh. 16.4 - Prob. 16.10CP
Ch. 16.4 - Prob. 16.11CPCh. 16 - Prob. 1RQECh. 16 - Prob. 2RQECh. 16 - Prob. 3RQECh. 16 - Prob. 4RQECh. 16 - What is unwinding the stack?Ch. 16 - What happens if an exception is thrown by a classs...Ch. 16 - How do you prevent a program from halting when the...Ch. 16 - Why is it more convenient to write a function...Ch. 16 - Why must you be careful when writing a function...Ch. 16 - The line containing a throw statement is known as...Ch. 16 - Prob. 11RQECh. 16 - Prob. 12RQECh. 16 - Prob. 13RQECh. 16 - The beginning of a template is marked by a(n)...Ch. 16 - Prob. 15RQECh. 16 - Prob. 16RQECh. 16 - Write a function that searches a numeric array for...Ch. 16 - Write a function that dynamically allocates a...Ch. 16 - Make the function you wrote in Question 17 a...Ch. 16 - Write a template for a function that displays the...Ch. 16 - Prob. 21RQECh. 16 - Prob. 22RQECh. 16 - Prob. 23RQECh. 16 - Prob. 24RQECh. 16 - T F All type parameters defined in a function...Ch. 16 - Prob. 26RQECh. 16 - T F A class object passed to a function template...Ch. 16 - Prob. 28RQECh. 16 - Prob. 29RQECh. 16 - Prob. 30RQECh. 16 - Prob. 31RQECh. 16 - T F A class template may not be derived from...Ch. 16 - T F A class template may not be used as a base...Ch. 16 - Prob. 34RQECh. 16 - Prob. 35RQECh. 16 - try { quotient = divide(num1, num2); } cout The...Ch. 16 - template class T T square(T number) { return T T;...Ch. 16 - template class T int square(int number) { return...Ch. 16 - Prob. 39RQECh. 16 - Assume the following definition appears in a...Ch. 16 - Assume the following statement appears in a...Ch. 16 - Prob. 1PCCh. 16 - Prob. 2PCCh. 16 - Prob. 3PCCh. 16 - Prob. 4PCCh. 16 - Prob. 5PCCh. 16 - IntArray Class Exception Chapter 14 presented an...Ch. 16 - TestScores Class Write a class named TestScores....Ch. 16 - Prob. 8PCCh. 16 - Prob. 9PCCh. 16 - SortableVector Class Template Write a class...Ch. 16 - Inheritance Modification Assuming you have...Ch. 16 - Prob. 12PCCh. 16 - Prob. 13PC
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
What are a classs responsibilities?
Starting out with Visual C# (4th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
If a class has a private field, what has access to the field?
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
What is the total serial transfer time for the eight bits in Figure 1-62? What is the total parallel transfer t...
Digital Fundamentals (11th Edition)
Write for statements that print the following sequences of values: 1, 2, 3, 4, 5, 6, 7 3, 8, 13, 18, 23 20, 14,...
C How to Program (8th Edition)
Suppose a is an array of values of type double that is partially filled. The array contains meaningful values i...
Java: An Introduction to Problem Solving and Programming (7th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Pointer and classImplement a class called Team as specified:data members:name - the name of the Team (defined as a dynamic variable)members - a dynamic array of stringsize - number of members in the team.functions:Course(): default constructor set name to “TBD”, and size to 0, members toempty listCourse(string): one argument constructor set name, and size to 0, members toempty listaccessor - an accessor for the name and size variablemutator - an mutator for the name variableUse following main() to test your class.int main() {Team a,b("Mets");cout<<a.getName()<<endl; // print TBDa.setName("Yankee");cout<<a.getName()<<endl; // print Yankeecout<<b.getName()<<endl; // print Metscout<<a.getSize()<<endl; // print 0return 0;}arrow_forwardINHERITANCE AND ERROR HANDLING OOP SUBJECTarrow_forwardSmart Pointer: Write a smart pointer class. A smart pointer is a data type, usually implemented with templates, that simulates a pointer while also providing automatic garbage collection. It automatically counts the number of references to a SmartPointer<?> object and frees the object of type T when the reference count hits zero.arrow_forward
- urgent helparrow_forwardBook Donation App Create a book-app directory. The app can be used to manage book donations and track donors and books. The catalog is implemented using the following classes: 1. The app should have donors-repo.js to maintain the list of donors and allow adding, updating, and deleting donors. The donor object has donorID, firstName, lastName, and email properties. This module should implement the following functions: • getDonor(donorId): returns a donor by id. • addDonor(donor): adds a donor to the list of donors; donorID should be autoassigned a random number. • updateDonor(donor): updates the donor having the matching donorID. • deleteDonor(donorID): delete the donor with donorID from the list of donors, only if they are not associated with any books. 2. The app should have books-repo.js to maintain the list of donated books and allow adding, updating, and deleting books. The book object has bookID, title, authors, and donorID properties. • donorID references the book’s donor. This…arrow_forwardWith output and also add comments. Thank youarrow_forward
- Polymorphism : Write a driver program that uses a AECar reference variable to point to three different types of classes, showing that inheritance is one mechanism for using polymorphism.arrow_forwardusing C++ 1- Creates a class called Member with two integer x and y.a. Add a constructor able to create a Member object with tow integers and the default values 0,0.b. Add the methods setX and setY to modify the attributes x and y; [2 Markc. Add the method display able to display the attributes. 2- A Stack is a special array where the insertion and deletion will be via a specific index called "head". A Stack is characterized by 3 attributes:a. capacity (int): the maximum number element Member that can be contained into the Stack.b. head: presents the index where we can add/remove element to the Stack. The head value presents also the current number of elements into the Stack. When a Stack is created the initial value of head is 0.c. Member content[]: an array of elements of type Member. Creates the class Stack with the following methods:a. bool empty(): this method returns true if no element exists in the Stack. b. bool full(): this method returns true if there are no place to add a…arrow_forwardC# Write a console app that sets up a dictionary of Books in a Library. The dictionary is indexed by ISBN. Each bookstored in the dictionary is a Book object that stores Title and Author. The Book class should be a simple entityclass containing the Title, Author, and ISBN.arrow_forward
- O In inheritance means the ability to reuse data values of one object by objects of .another classarrow_forward2. List Copy Constructor Modify your ist ciass of Programming Chalenge 1 to add a copy constructor. Test your class by making a copy of a ist and then testing membership on the copy.arrow_forwardC++ Program Assignment 1: Inheritance Create a base class and also a class that is derived from the base class. The base class needs to very generic, but would expect at least 4 data items. You must code getters and setters but it is OK to code in-line methods in the same file as this class. The derived class should use the public access specification. The code can be based on anything you like. Examples could be: Base Class Derived ClassMusic Instrument TrumpetCake Birthday or Wedding CakeAnimal Bear, Cat, or more general such as mammal, fish, etcAssignment:1. In your main code, create an instance variable based on your base class and also an instance variable based on your derived class.2. Set variable values for each instance. ( Call the setters).3. Create a method that will display the values in both objects and call that method. This method should not be part of these classes. For this step, you pass both…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY