Question: Problem 2 is from the textbook exercise 3 . 1 1 . 3 . 1 1 ( EmpLoyee Class ) Create a class called Employee
Problem is from the textbook exercise
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
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 percent raise and display each Employee's yearly salary again.
Task add the copy constructor of class Employee. points
Task add the destructor of class Employee. points
Task address the requirements in the and Task and 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. 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 h h: ;
minute m & m m : ;
second s && s : ;
end function setTime
Use member initialization list to program the constructor with three parameters.
Task Write a new test function called int testMinimalEmployeeSalary Create an array of Employee objects with minimal 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. points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
