onsider a base class Employeewhich contain basic information of an employee such as: Name(string) Address(string) Id(int) Gender(string) Now create two constructors A default constructor to initialize the data member with default values, A four-argument constructor to initialize data field with user-define values ( must use this key word). Getter and setter function to set and get values of data fields. Derives two classes to show Hierarchical inheritance. A departmentclass which extends the base class employee also have some its own information such as: Department Name(string) Department Id(int). Now create two constructors a default constructor to initialize the data member with default values, a parameterized constructorto initialize data field with user-define values. Appropriate getter and setter function to set and get values of data fields. A display method to show all the records of employee along with department information. Create another child class Loanwhich extends the base class employee and also have some its own properties such as: Loan Amount(float) Loan type(string) Now create two constructors a default constructor to initialize the data member with default values, a parameterized constructorto initialize data field with user-define values. Appropriate getter and setter function to set and get values of data fields. A display method to show all the records of employee along with loan information. In main class you have to create an object of employee class to set the values of the data member with user define values (either through constructors or setter functions). An object of department class to set the values of the data member with user define values (either through constructors or setter functions)and call the display method. An object of loan class to set the values of the data member with user define values (either through constructors or setter functions)and call the display meth
Consider a base class Employeewhich contain basic information of an employee such as:
Name(string)
Address(string)
Id(int)
Gender(string)
Now create two constructors A default constructor to initialize the data member with default values, A four-argument constructor to initialize data field with user-define values ( must use this key word). Getter and setter function to set and get values of data fields.
Derives two classes to show Hierarchical inheritance.
A departmentclass which extends the base class employee also have some its own information such as:
Department Name(string)
Department Id(int).
Now create two constructors a default constructor to initialize the data member with default values, a parameterized constructorto initialize data field with user-define values. Appropriate getter and setter function to set and get values of data fields. A display method to show all the records of employee along with department information.
Create another child class Loanwhich extends the base class employee and also have some its own properties such as:
Loan Amount(float)
Loan type(string)
Now create two constructors a default constructor to initialize the data member with default values, a parameterized constructorto initialize data field with user-define values. Appropriate getter and setter function to set and get values of data fields. A display method to show all the records of employee along with loan information.
In main class you have to create an object of employee class to set the values of the data member with user define values (either through constructors or setter functions). An object of department class to set the values of the data member with user define values (either through constructors or setter functions)and call the display method. An object of loan class to set the values of the data member with user define values (either through constructors or setter functions)and call the display method.
Step by step
Solved in 2 steps with 1 images