Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ not in a project, all in source file. please. Problem: Consider the definition of the following class: class employee public: employee0: employee(string, int, double);
C++
not in a project, all in source file. please.
Problem: Consider the definition of the following class: class employee public: employee0: employee(string, int, double); employee(int, double); employee(string); void setData(string, int, double); void print() const; void updateSalary(double x): int getNumOfServiceYears() const; double getSalary) const; private: string name; int numOfServiceYears; double salary; /Line 1 //Line 2 Line 3 Line 4 //Line 5 //Line 6 Line 7 Line 8 Line 9 Line 10 Line 11 //Line 12 /Line 13 Line 14 //Line 15 //Line 16 Line 17 20 Pts. a. Give the line number containing the constructor that is executed in each of the following declarations i. employee tempEmployee; ii. employee newEmployee("Harry Miller", 0, 25000); iii. employee oldEmployee("Bill Dunbar", 15, 55000); b. Write the definition of the constructor in Line 4 so that the instance variables are initialized to " ", 0, and 0.0, respectively. d. Write the definition of the constructor in Line 6 so that the instance variable name is initialized to the empty string and the remaining instance variables are initialized according to the parameters. 40 Pts 1) Write the definition of the function setData so that the instance variables are set according to the parameters 2) Write the definition of the function print to output the values of the instance variables. 3 Write the definition of the function updateSalary to update the value of the instance variable salary by adding the value of the parameter Write the definition of the function getNumOfService Years to return the value of the instance variable numOfServiceYears. 4)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started