Question: Problem 2 is from the textbook exercise 3 . 1 1 . 3 . 1 1 ( EmpLoyee Class ) Create a class called Employee

Problem 2 is from the textbook exercise 3.11.
3.11( EmpLoyee Class) Create a class called Employee that includes three pieces of information as data membersa first name (type string), a last name (type string) and a monthly salary (type int). Your class should have a constructor that initializes the three data members. Provide a set and a get function for each data member. If the monthly salary is not positive, set it to
0. Write a test program that demonstrates class Employee's capabilities.
Create two Employee objects and display each object's yearly salary. Then give each Employee a 10 percent raise and display each Employee's yearly salary again.
Task 2.1 add the copy constructor of class Employee. (10 points)
Task 2.2 add the destructor of class Employee. (10 points)
Task 2.3 address the requirements in the 3.11 and Task 2.1 and 2.2. The test program should follow the unit testing structure introduced at the lecture demos. (A reference example is on the "Summary and reference" web page on Moodle.)(20 points)
Checking the if the monthly salary is positive or not and setting the value to zero can follow the example of class Time in the lecture:
void Time::setTime( int h, int m, int s )
hour =(h >=088 h <24)? h: 0;
minute =(m >=08& m <60)? m : 0;
second =(s >=0 && s <60)?5: 0;
}// end function setTime
Use member initialization list to program the constructor with three parameters.
Task 2.4 Write a new test function called int testMinimalEmployeeSalary(). Create an array of Employee objects with minimal 10 objects with different salary values. This function returns the minimal salary value among all the Employee objects. The main() function should invoke testMinimalEmployeeSalary() in an assert form to print out if the test passes or fails. (20 points)

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 Programming Questions!