Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a class Employee with data members: agelan integer), id (an integer) and salary (a float), and their corresponding member functions as follows class Employee

image text in transcribedimage text in transcribed

Consider a class Employee with data members: agelan integer), id (an integer) and salary (a float), and their corresponding member functions as follows class Employee private int age; nt 1 float salary; public Employee(); // default constructor: 0. d-0, salary-0.0 Employee(int x, int y, float z); // parameterized constructor: age-x, id-y, osalaryz -Employee(); // destructor: age-0. d-0, salary = 0.0 Employee.const Employee &); // copy constructor Employee & operator =(const Employee &); // = operator overloading void setAge(int x); void setld(int x); void setSalarv(floatx) int getAgel) fotetSal) You need to provide the definition of all the above member functions. Write a main routine in which you create an array of Employee with 3 elements. Set the first element with the content (age-30, id = 30042554, salary=50000.00), the second element with the content (age-45, id-40041002, salary-60000.00), and the third element with the content (age-50, id-40041004, salary-70000.00). by using the setXXX member functions. Then, pass the array to a function PrintEmployee(argl, arg2), in which argl should be the array of Employee and arg2 is the length of the array (3 in this case). In PrinteEmployee(arg1, arg2), write a for loop to print out the information of each employee by using the fourth through sixth member functions and cout (in this case, we have three employees in total)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions