Question

The purpose of this lab is to practice the concept of inheritance. We will create an...

The purpose of this lab is to practice the concept of inheritance. We will create an Hourly class that is an Employee class. In other words, the Hourly class inherits from the Employee class. In addition, we will create a Salary class that inherits from the Employee class. Finally, we will make a Child class work as a Parent class. We will create a Manager class that inherits from the Salary class.

Create a C++ project, and call it Week 5—Inheritance. Now, let's realize the UML class diagram, which means let's take the UML class diagram to code.

  • Create an Employee class using a separate header file and implementation file.
    • Review your UML class diagram for the attributes and behaviors
      • The calculatePay() method should return 0.0f.
      • The toString() method should return the attribute values ("state of the object").
  • Create an Hourly class using a separate header file and implementation file.
    • The Hourly class needs to inherit from the Employee class
    • The calculatePay() method should return the pay based on the number of hours worked and the pay rate. Remember to calculate overtime!
  • Create a Salary class using a separate header file and implementation file.
    • The Salary class needs to inherit from the Employee class.
    • The calculatePay() method should return the annualSalary divided by 52.0f because there are 52 weeks in the year.
  • Create a Manager class using a separate header and implementation file.
    • The Manager class needs to inherit from the Salary class (yes, a Child class can be a Parent class).
    • The calculatePay() method should use the Salary's calculatePay() method plus the bonus divided by 52.0f (base pay plus bonus).
0 0
Add a comment Improve this question Transcribed image text
Answer #1

OUTPUT

Add a comment
Know the answer?
Add Answer to:
The purpose of this lab is to practice the concept of inheritance. We will create an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is done in C++ Create an Employee class using a separate header file and implementation...

    This is done in C++ Create an Employee class using a separate header file and implementation file. Review your UML class diagram for the attributes and behaviors The calculatePay() method should return 0.0f. The toString() method should return the attribute values ("state of the object"). Create an Hourly class using a separate header file and implementation file. The Hourly class needs to inherit from the Employee class The calculatePay() method should return the pay based on the number of hours...

  • Create a C++ project Create an Employee class using a separate header file and implementation file....

    Create a C++ project Create an Employee class using a separate header file and implementation file. The calculatePay() method should return 0.0f. The toString() method should return the attribute values ("state of the object"). Create an Hourly class using a separate header file and implementation file. The Hourly class needs to inherit from the Employee class The calculatePay() method should return the pay based on the number of hours worked and the pay rate. Remember to calculate overtime! Create a...

  • Java Problem 2: Employee (10 points) (Software Design) Create an abstract class that represents an Employee and contains abstract method payment. Create concrete classes: SalaryEmployee, CommissionEm...

    Java Problem 2: Employee (10 points) (Software Design) Create an abstract class that represents an Employee and contains abstract method payment. Create concrete classes: SalaryEmployee, CommissionEmployee, HourlyEmployee which extend the Employee class and implements that abstract method. A Salary Employee has a salary, a Commision Employee has a commission rate and total sales, and Hourly Employee as an hourly rate and hours worked Software Architecture: The Employee class is the abstract super class and must be instantiated by one of...

  • UML Class Diagram with Inheritance Objectives Use UML Correctly indicate inheritance Demonstrate permissions Understand inheritance relationships...

    UML Class Diagram with Inheritance Objectives Use UML Correctly indicate inheritance Demonstrate permissions Understand inheritance relationships Labwork Please read all of the directions carefully. You will create a UML class diagram reflecting the class hierarchy for a fictional program that manages university personnel as constructed according to the graph displayed below. You will need to think about the attributes and behaviors that are unique to each class, and also those attributes and behaviors that are common amongst the subclasses and...

  • Goal: In this lab, we will practice how to apply both the inheritance and composition concepts...

    Goal: In this lab, we will practice how to apply both the inheritance and composition concepts to write a Department class. 1. Implement the Department Class. Implement the following class: public class Department{ * The basic feature of a department */ private String deptName; private int numMajors; private Teacher[] list Teachers; //inherits from Person class private Student[] listStudents; //inherits from Person class /* Construct a department object (at least TWO constructors) */ * Accessors and mutators (one pair per each...

  • In C++, please. Given an integer numbers N, create a class 'ProblemSolution' which demonstrates inheritance with...

    In C++, please. Given an integer numbers N, create a class 'ProblemSolution' which demonstrates inheritance with the following characteristics 1. Must inherit from 'Base' class. 2. Create a 'solution' method with an integer parameter and void return type. 3. The 'solution' method should assign the given value N into 'Base' class property 'num' and call the 'display' function of 'Base' class. What is inheritance? Inheritance is a mechanism in which one object acquires all the properties and behaviors of the...

  • Within c++ Create a simple Employee class with name, department, and title. Create an hourlyEmployee class...

    Within c++ Create a simple Employee class with name, department, and title. Create an hourlyEmployee class (which inherits from the Employee class) for a basic payroll program to compute the net pay salary of hourly based employees. Your program should also find the average net pay for a small company. To define the class, include the appropriate data members, member functions, constructors, and access modifiers. For simplicity, use a constant tax rate of 30% to compute the tax amount. Employees...

  • C++ Lab 9B Inheritance Class Production Worker Create a project C2010Lab9b; add a source file Lab...

    C++ Lab 9B Inheritance Class Production Worker Create a project C2010Lab9b; add a source file Lab9b.cpp to the project. Copy and paste the code is listed below: Next, write a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have member variables to hold the following information: Shift (an integer) Hourly pay rate (a double) // Specification file for the ProductionWorker Class #ifndef PRODUCTION_WORKER_H #define PRODUCTION_WORKER_H #include "Employee.h" #include <string> using namespace std; class ProductionWorker...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT