Starting Out with C++ from Control Structures to Objects (8th Edition)
8th Edition
ISBN: 9780133769395
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 16, Problem 43RQE
T F A class template may not be used as a base class.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Problem: Employee and ProductionWorker Classes
Write a python class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information:
• Shift number (an integer, such as 1, 2, or 3)• Hourly pay rateThe workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for this class. Once you have written the class, write a program that creates an object of the ProductionWorker class, and prompts the user to enter data for each of the object’s data attributes. Store the data in the object, then use the object’s accessor methods to retrieve it and display it on the screen
Note: The program should be written in python.
Sample Input/Output:
Enter the name: Ahmed Al-AliEnter the ID number: 12345Enter the department:…
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()…
Chapter 16 Solutions
Starting Out with C++ from Control Structures to Objects (8th 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 - Prob. 10RQECh. 16 - Prob. 11RQECh. 16 - Prob. 12RQECh. 16 - The line containing a throw statement is known as...Ch. 16 - Prob. 14RQECh. 16 - Prob. 15RQECh. 16 - Prob. 16RQECh. 16 - The beginning of a template is marked by a(n)...Ch. 16 - Prob. 18RQECh. 16 - Prob. 19RQECh. 16 - Prob. 20RQECh. 16 - Prob. 21RQECh. 16 - _____________ are pointer-like objects used to...Ch. 16 - Prob. 23RQECh. 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. 28RQECh. 16 - Prob. 29RQECh. 16 - Prob. 30RQECh. 16 - Prob. 31RQECh. 16 - Prob. 32RQECh. 16 - Prob. 33RQECh. 16 - Prob. 34RQECh. 16 - T F All type parameters defined in a function...Ch. 16 - Prob. 36RQECh. 16 - T F A class object passed to a function template...Ch. 16 - Prob. 38RQECh. 16 - Prob. 39RQECh. 16 - Prob. 40RQECh. 16 - Prob. 41RQECh. 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. 44RQECh. 16 - Prob. 45RQECh. 16 - Prob. 46RQECh. 16 - Prob. 47RQECh. 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. 51RQECh. 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. 9PCCh. 16 - SortableVector Class Template Write a class...Ch. 16 - Inheritance Modification Assuming you have...Ch. 16 - Prob. 12PCCh. 16 - Prob. 13PCCh. 16 - 14. Test Scores vector
Modify Programming...Ch. 16 - Prob. 15PCCh. 16 - Prob. 16PCCh. 16 - Prob. 17PC
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Theprogramming language was developed by Bjarne Stroustrup in the early 1980s at Bell Laboratories.
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Use the Web to research the history of the BASIC, C++, Java, and Python programming languages, and answer the f...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
T F: A local variable may be accessed by any other procedure in the same Form file.
Starting Out With Visual Basic (8th Edition)
_____ is the only language computers can process directly, without any conversion required.
Starting Out With Visual Basic (7th Edition)
Suppose a typist could type 60 words per minute continuously, day after day. How long would it take the typist ...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
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
- T F Classes are allowed to contain both functions and variables.arrow_forwardT F The public members of a class may be directly accessed from functions that are inside (part of the classarrow_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
- c++ languagearrow_forwardEmployee class Write a Python program employee.py that computes the cumulative salary of employees based on the length of their contract and their annual merit rate. Your program must include a class Employee with the following requirements: Class attributes: name: the name of the employee position: the position of the employee start_salary: the starting salary of the employee annual_rate: the annual merit rate on the salary contract_years: the number of years of salary Class method: get_cumulative_salary(): calculates and returns the cumulative salary of an employee based on the number of contract years. Round the cumulative salary to two digits after the decimal point. Example: If start_salary = 100000, annual_rate = 5% and contract_years = 3: Then the cumulative salary should be : 100000 + 105000 + 110250 = 315250 Outside of the class Employee, the program should have two functions: Function name Function description Function input(s) Function output(s) / return…arrow_forwardProgramming Language= PYTHON 1. Pet Class Write a class named Pet, which should have the following data attributes: • _ _name (for the name of a pet) • _ _animal_type (for the type of animal that a pet is. Example values are ‘Dog’, ‘Cat’, and ‘Bird’) • _ _age (for the pet’s age) The Pet class should have an _ _init_ _ method that creates these attributes. It should also have the following methods: • set_name This method assigns a value to the _ _name field. • set_animal_type This method assigns a value to the _ _animal_type field. • set_age This method assigns a value to the _ _age field. • get_name This method returns the value of the _ _ name field. • get_animal_type This method returns the value of the _ _animal_type field. • get_age This method returns the value of the _ _age field. Once you have written the class, write a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored as the object’s…arrow_forward
- c++ class runner with constructor and COPY CONSTRUCTORarrow_forwardc++ Write a class named TestScores. The class constructor should accept an array of test scores as itsargument. The class should have a member function that returns the average of the test scores. If any testscore in an array is negative or greater than 100 it should display a message.arrow_forwardStatic vs. non-static class data members: What real-world circumstance might benefit from a static data member?arrow_forward
- C++ True/False: a member function in a class can access all of its class's member variables, but not if the variables are private.arrow_forwardFill-in-the-Blank To allow an array of structures or an array of objects to be initialized, the struct or class declaration should include a(n) _________.arrow_forwardDate class to use: #ifndef DATE_H_ #define DATE_H_ #include <iostream> #include <iomanip> using namespace std; class Date { friend ostream &operator<<( ostream &, const Date & ); private: int day; int month; int year; static const int days[]; // array of days per month void helpIncrement(); // utility function for incrementing date public: Date(int=1, int=1, int=0); void setDate(int,int,int); bool leapYear( int ) const; // is date in a leap year? bool endOfMonth( int ) const; // is date at the end of month? Date &operator++(); // prefix increment operator Date operator++( int ); // postfix increment operator const Date &operator+=( int ); // add days, modify object bool operator<(const Date&) const; void showdate(); }; const int Date::days[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; Date::Date(int d, int m, int y) { day = d; month = m; year = y; // initialize static member at file scope; one classwide copy } // set month,…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.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