C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 20, Problem 20.9E
(Abstract Base Classes) Suggest one or more levels of abstract base classes for the Shape hierarchy discussed in this chapter and shown in Fig19.3. (The first level is Shape, and the second level consists of the classes TwoDimensionalShape and ThreeDimensionalShape.)
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Nutritional information (classes/constructors) PYTHON ONLY
Complete the FoodItem class by adding a constructor to initialize a food item. The constructor should initialize the name (a string) to "None" and all other instance attributes to 0.0 by default. If the constructor is called with a food name, grams of fat, grams of carbohydrates, and grams of protein, the constructor should assign each instance attribute with the appropriate parameter value.
The given program accepts as input a food item name, fat, carbs, and protein and the number of servings. The program creates a food item using the constructor parameters' default values and a food item using the input values. The program outputs the nutritional information and calories per serving for both food items.
Ex: If the input is:
M&M's10.034.02.01.0
where M&M's is the food name, 10.0 is the grams of fat, 34.0 is the grams of carbohydrates, 2.0 is the grams of protein, and 1.0 is the number of servings, the output is:…
programming language : C++
subject : object oriented programming
question:
We know that an Organization consists of Managers and Employees. You are required to create a base class Person with attributes name, CNIC and gender. Derive Manager and Employee class from Person class.
With appropriate examples, explain the features of static class members.
Chapter 20 Solutions
C How to Program (8th Edition)
Ch. 20 - Prob. 20.3ECh. 20 - (Polymorphism vs. switch logic) Discuss the...Ch. 20 - (Inheriting Interface vs. Implementation)...Ch. 20 - Prob. 20.6ECh. 20 - (Dynamic Binding vs. Static Binding) Distinguish...Ch. 20 - Prob. 20.8ECh. 20 - (Abstract Base Classes) Suggest one or more levels...Ch. 20 - Prob. 20.10ECh. 20 - (Polymorphic Application) Youve been asked to...Ch. 20 - (Payroll System Modification) Modify the payroll...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
T F When an array of objects is defined, the constructor is only called for the first element.
Starting Out with C++ from Control Structures to Objects (9th Edition)
The decimal number system is a weighted system with ten digits.
Digital Fundamentals (11th Edition)
Write a program that reads in five amounts of money, doubles each amount, and then writes out the doubled value...
Problem Solving with C++ (10th Edition)
Car Loan If A dollars are borrowed at r interest compounded monthly to purchase a car with monthly payments for...
Introduction To Programming Using Visual Basic (11th Edition)
A(n) _____ is a specialized routine that performs a specific operation and then returns a value.
Starting Out With Visual Basic (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
- Finish the following programs. Define two public abstract class called ListNode and List. The ListNode class has 2 non-public fields, one called item which is of type Object and references the item stored in the current node, the other called myList which is of type List and references the list that contains this node. The List class has one non-public field, called size which is the number of items in the list. Both ListNode and List class are defined in the package called mylist and their subclasses in any package can access to both item, myLis or size. isEmpty() returns true if this list is empty, false otherwise. You can ignore the definition and use of the InvalidNodeException class. //definition of the ListNode class _______________________; _______________________ { _____________________; _____________________; public boolean isValidNode() {…arrow_forward5. Is it compulsory for a class, which has been declared as abstract, to have at least one abstract method?arrow_forwardState a circumstance in which you would prefer an interface over an abstract class. Also, State a circumstance in which you would prefer an abstract class over an interface.arrow_forward
- Game of Chess in C++ The objective of this assignment is to practice concepts related to inheritance, overriding, polymorphism, and abstract classes, to program the basics of a chess playing program. About: Chess is played on an 8 X 8 board where the initial placement of pieces. The white king is on e1, and the black king is on e8. Each chess piece can move in a specific way. Follow a simplified version. Most importantly, ignore an important rule in chess: Moving any piece in a way that puts your own king in check is illegal. Since we don't know what check means, for us a move is legal if the piece we are moving has an empty square to move to or can capture (replace) an opponent's piece (including their king). The king does not move at all. Nor can it castle the queen and knight can't move either. A pawn in the initial position may move one or two squares vertically forward to an empty square but cannot leap over any piece. Subsequently it can move only one square vertically forward…arrow_forward*Initial Class Diagram is attached below Refine the UML class diagram so that it demonstrates the following: Classes (using the complex class symbols), Associations (with multiplicities AND association names), Generalizations (if any), and Compositions (if any) Focus ONLY on the following activities within the system: Start a Trip, Reserve a Vehicle, Make a Parking Reservation, Make a Charging Session for a Personal Vehicle, End a Trip or Charging Session, and Submit a Support Ticket for a Vehicle or Station Add the primary key necessary to support any relationships that have a multiplicity of "1" as an attribute in the corresponding classarrow_forward(3) Briefly (in just a few words), describe the difference between an instance and a classarrow_forward
- SUBJECT: OOPPROGRAMMING LANGUAGE: C++ ALSO ADD SCREENSHOTS OF OUTPUT. Write a class Distance to measure distance in meters and kilometers. The class should have appropriate constructors for initializing members to 0 as well as user provided values. The class should have display function to display the data members on screen. Write another class Time to measure time in hours and minutes. The class should have appropriate constructors for initializing members to 0 as well as user provided values. The class should have display function to display the data members on screen. Write another class which has appropriate functions for taking objects of the Distance class and Time class to store time and distance in a file. Make the data members and functions in your program const where applicablearrow_forward2. Explain the concept of Composition and Association class relationships.arrow_forwardjavaarrow_forward
- Object oriented programming C++ Use Classes Write a C++ program in which each flight is required to have a date of departure, a time of departure, a date of arrival and a time of arrival. Furthermore, each flight has a unique flight ID and the information whether the flight is direct or not.Create a C++ class to model a flight. (Note: Make separate classes for Date and Time and use composition).add two integer data members to the Flight class, one to store the total number of seats in the flight and the other to store the number of seats that have been reserved. Provide all standard functions in each of the Date, Time and Flight classes (Constructors, set/get methods and display methods etc.).Add a member function delayFlight(int) in the Flight class to delay the flight by the number of minutes pass as input to this function. (For simplicity, assume that delaying a flight will not change the Date). Add a member function reserveSeat(int) which reserves the number of seats passed as…arrow_forwardConsider the definition of the class product Type as given in Exercise 8. Which function members are accessors and which are mutators? (4)arrow_forwardCPS 2231 - Lab 5 Abstract Classes and Interfaces Write the code for all the necessary classes and/or interfaces for a solution to the problem below. Focus on class structure and interaction. You may implement your solution however you wish, but you will be graded on the appropriateness of your solution to the requirements. Note the use of capitalization and bold for clarification in the problem. You may use whatever constructors or additional methods you wish. - Define a structure that can represent Animals. - A general Animal should not be able to be instantiated and has a permanent name for its lifetime. Animals have two behaviors, they can speak() and they can move(). By default, when an animal moves, the message "This animal moves forward" is displayed. By default, when an animal speaks, the message "This animal speaks" is displayed - Define also two classes, Goose and Lynx, that are Animals. Both Goose and Lynx behave such that where "animal is displayed in speak() or…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 LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
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