Question: Objectives Exploring Inheritance and Overriding Methods Be able to design inheritance class relationships Be able to use an abstract class Be able to override a

Objectives

  • Exploring Inheritance and Overriding Methods
  • Be able to design inheritance class relationships
  • Be able to use an abstract class
  • Be able to override a virtual methods and implement an abstract method

Pre-Lab Questions

  1. Give an example of a good use of an abstract class not mentioned in the class.
  2. How many children can any parent class have? How many parents can a child class have?
  3. How can you make sure a method is not overridden in a child class?

Activities:

In this lab activity, we design an inheritance hierarchy containing types of employees in a companys payroll application. In this company, commission employees (who will be represented as objects of a superclass) are paid a percentage of their sales, while base-salaried commission employees (who will be represented as objects of a subclass) receive a base salary plus a percentage of their sales.

You need to implement the following design.

In the Testapplication you need to create a commissionEmployee object and a BasePlusCommissionEployee object using a data of your choice. Then call the toString method and print the earning on each object.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!