Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the following classes: Person - name: String - age: int - address: String / * constructor, accessor, mutator * / Employee - department: String

Implement the following classes:
Person
- name: String
- age: int
- address: String
/* constructor, accessor, mutator */
Employee
- department: String
- designation: String
/* constructor, accessor, mutator */
PartTimeEmployee
- hours: double
- rate: double
/* constructor */
/* accessor-mutator */
/* toString */
+ salary(): double
FullTimeEmployee
- basic: double
- allowance: double
/* constructor */
/* accessor-mutator */
/* toString */
+ salary(): double
The relationship is as follows:
Employee extends Person
PartTimeEmployee extends Employee
FullTimeEmployee extends Employee
Create an object for PartTimeEmployee and FullTimeEmployee and print their salary.
For FullTimeEmployee, basic is the base salary, i.e.15000.
Allowance is usually provided as percentage, i.e.25%.
So the total salary of a full time employee =15000+25% of 15000=1875

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions