Concept explainers
(Student Inheritance Hierarchy) Draw an inheritance hierarchy for students at a university similar to the hierarchy shown in Fig19.2. Use Student as the base class of the hierarchy, then include classes UndergraduateStudent and GraduateStudent that derive from Student. Continue to extend the hierarchy as deep (i.e., as many levels) as possible. For example, Freshman, Sophomore, Junior and Senior might derive from UndergraduateStudent, and DoctoralStudent and Masters Student might derive from GraduateStudent. After drawing the hierarchy, discuss the relationships that exist between the classes. [Note: You do not need to write any code for this exercise.]
Want to see the full answer?
Check out a sample textbook solutionChapter 19 Solutions
EBK C HOW TO PROGRAM
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Starting Out With Visual Basic (7th Edition)
Starting Out with Python (3rd Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
- Consider the definition of the class product Type as given in Exercise 8. Which function members are accessors and which are mutators? (4)arrow_forwardprogramming 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.arrow_forwardSUBJECT: OOPPROGRAMMING LANGUAGE: C++ ADD SS OF OUTPUT TOO. Create a class Student with attributes StudentName, Enrollment, semester, section, course MarksObtained and Grade. Write appropriate constructors, get and set functions for data members. The data member grade is automatically calculated based on marks obtained out of 100 for each course.arrow_forward
- (b) How does the static data member of a class differ from a non-static data member? Give a real-world scenario in which a static data member might be useful.arrow_forwardQuestion 2 (Student Inheritance Hierarchy) Draw a UML class diagram for an inheritance hierarchy for students at a university similar to the hierarchy shown in Fig. 11.2. Use Student as the base class of the hierarchy, then extend Student with classes UndergraduateStudent and GraduateStudent. Continue to extend the hierarchy as deeply (i.e., as many levels) as possible. For example, Freshman, Sophomore, Junior and Senior might extend UndergraduateStudent, and DoctoralStudent and MastersStudent might be derived classes of GraduateStudent. After drawing the hierarchy, discuss the relationships that exist between the classes.arrow_forward(Richer Shape Hierarchy) The world of shapes is much richer than the shapes included inthe inheritance hierarchy of Fig. 19.3. Write down all the shapes you can think of—both two-dimensional and three-dimensional—and form them into a more complete Shape hierarchy with asmany levels as possible. Your hierarchy should have the base class Shape from which class TwoDimensionalShape and class ThreeDimensionalShape are derived. [Note: You do not need to write any codefor this exercise.] We’ll use this hierarchy in the exercises of Chapter 20 to process a set of distinctshapes as objects of base-class Shape. (This technique, called polymorphism, is the subject ofChapter 20.)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(a) Which of the following are true about Object-Oriented Programming (00P). Choose ALL that apply. A. 00P allows us to define new classes B. Use of inheritance allows us to reuse code without having to rewrite it C. A parent class can have at most one child class in Python D. ALl methods in the parent class must be overridden by the child classarrow_forwardGame 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
- OOP Homework Inheritance (PYTHON) 1. Given two classes as described in Customer.py (attached) Revise the class using inheritance to simplify the codes and to remove repetition of codes. Package-delivery services, such as FedEx®, DHL® and UPS®, offer a umber of different shipping options, each with specific costs associated. Create an inheritance hierarchy to represent various types of packages. Output: Sender: Ellen Abberton WR10 Recipient: Dane Abbey Dore, HR2 Cost: £40e Sender: Mike Agglethorpe DL8 Recipient: Andy Acton Bridge, CW8 Cost: £68e Sender: Andy Acton Bridge CW8 Recipient: Luke Abingworth, RH20 Cost: £61earrow_forwardSUBJECT: 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_forwardProgramme in C++. Create any two classes and conduct inheritance by adding 3 data members to parent class and 2 to child class. (classes should include data members). Parent class requires a parameterized constructor. Parent class constructor requires child class constructor values. Create a child class object and show its data on the console.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning