Create a C++ project
Create an Employee class using a separate header file and implementation file.
Add a Source.cpp file to your project.
string Hourly::toString() // #include <sstream> in
Hourly.h
{
stringstream ss;
ss << "PayRate :" << hourlyRate << endl;
ss << "Hours Worked:" << hoursWorked <<
endl;
return ss.str();
}
Salary.h
/* Salary.h */
#include <string>
#include "Employee.h"
using namespace std;
class Salary : public Employee {
private:
float annualSalary;
public:
Salary(float a);
float calculatePay();
string toString();
};
Salary.cpp
#include "Salary.h"
using namespace std;
Salary::Salary(float a){
annualSalary = a;
}
float Salary::calculatePay(){
return annualSalary/52.0;
}
string Salary::toString(){
stringstream ss;
ss << "Annual Salary: $" << annualSalary;
return ss.str();
}
/* Manager.h */
#include <string>
#include "Salary.h"
using namespace std;
class Manager : public Salary {
private:
float bonus;
public:
Manager(float a, float b):public Salary(a){
bonus = b;
}
float calculatePay();
string toString();
};
Manager.cpp
#include "Manager.h"
using namespace std;
float Manager::calculatePay(){
return Salary::calculatePay + bonus/52.0;
}
string Salary::toString(){
stringstream ss;
ss << "Bonus: $" << bonus;
return Salary::toString() + "/n" + ss.str();
}
Create a C++ project Create an Employee class using a separate header file and implementation file....
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...
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...
Part (A) Note: This class must be created in a separate cpp file Create a class Employee with the following attributes and operations: Attributes (Data members): i. An array to store the employee name. The length of this array is 256 bytes. ii. An array to store the company name. The length of this array is 256 bytes. iii. An array to store the department name. The length of this array is 256 bytes. iv. An unsigned integer to store...
IN C++ MUST INCLUDE HEADER FILE, IMPLEMENTATION FILE, AND DRIVER FILE. IN C++ Create a header and implementation file to define an apartment class. Create a driver program to test the class, and create a make file to compile the driver program. Create two files called apartment.h and appartmentImp.cpp along with creating a driver program named testApartment.cpp containing the main function. Program Requirements: • Class attributes should include integers for number of rooms, monthly rent, and square feet, as well...
C++ project we need to create a class for Book and Warehouse
using Book.h and Warehouse.h header files given. Then make a main
program using Book and Warehouse to read data from book.dat and
have functions to list and find book by isbn
Objectives: Class Association and operator overloading This project is a continuation from Project 1. The program should accept the same input data file and support the same list and find operations. You will change the implementation of...
Create another Java class named EmployeeMain within the same project, which includes the main method. a. Include another class named Employee in the same Java file. This class has the following instance variables and instance methods. Define all the instance/static variables with private access modifier and constructors, instance/static methods with public access modifier. Instance Variables empID: int employeeName: String basicSalary: double Constructor Set the value for empID. Instance Methods Get and set methods for all instance variables. displayEmployee: Display the...
Use C++ Create a Student header file (C++) . Declare the following operations in the file. setName() setMarks() setDateOfBirth() calculateGrade() - This method should compute and return grades based on the mark the student entered calculateAge() - This method should compute and return age using the DateOfBirth the user entered displayDetails() - This method should return a string displaying all the details of the user. Now write the implementation class for the header file. Now reuse these C++ Code in...
Create an abstract class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create an abstract method called earnings. Create another class HourlyEmployee that inherits from the abstract Employee class. HourEmployee must use the inherited parent class variables and add in attributes HourlyRate and HoursWorked. Your HourEmployee class should...