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
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.2: Providing Class Conversion Capabilities
Problem 6E
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
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
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.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
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
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
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
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning