In the main() function, create an object of VisitingProfessor and invoke its member function display() to show total income and the number of courses he/she has been taught

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.4: Class Inheritance And Polymorphism
Problem 5E
icon
Related questions
Question

This is an object oriented programming question

The code should be in C++ language.

Design a class named Staff that includes

  • A data member named staffID
  • A setter function to initialize staffID
  • A getter function to get the value of staffID

 

Derive a class named Professor inherited from Staff class and contains

  • Two additional data members i.e. departmentID and departmentName
  • A parameterized constructor to initialize its own data fields along with the inherited data field
  • Two getter functions that return the departmentID and departmentName, respectively

 

Derive a class named VisitingProfessor inherited from class Professor and has

  • A data field named no_of_courses
  • A data field named salary_per_course
  • A function named totalSalary that returns total payment for all courses (i.e. no_of_courses * salary_per_course)
  • A member function named display to show total salary and the number of courses he/she has been taught

 

In the main() function, create an object of VisitingProfessor and invoke its member function display() to show total income and the number of courses he/she has been taught.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Data members
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,