Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

undefined 1. [15 Points] In Onion Garments Ltd, the employees can be divided into two types based on their way of earning. The first type

image text in transcribedundefined

1. [15 Points] In Onion Garments Ltd, the employees can be divided into two types based on their way of earning. The first type of employees gets a fixed monthly salary at the end of each month. The salary is calculated by summing basic salary, 30% of the basic salary as house rent, and 5% of basic salary as medical allowance. Employees can also work on an hourly basis who get a salary depending on the number of hours they work in a month. The salary is calculated by multiplying the hours and hourly pay rate. This rate varies from employee to employee. a. [5 points] Design a class Employee with its attributes and methods including an abstract method calculate Salary() which calculates the salary of each employee and a protected attribute which keeps the salary amount. Design two classes FixedSalary Employee and HourlyRate Employee that inherit the Employee class. The class descriptions are given in the UML diagram below. b. [10 points] The sub-classes have to implement the abstract method calculate Salary(). The toString() method is overridden in the two sub-classes to print the name, mobile number, and salary. FixedSalaryEmployee -basic Salary: double Employee #name:String #mobileNum:String #salary: double HourlyBasisEmployee +calculate Salaryo:double (abstract) +toStringo:String -perHourRate:double -totalHours:double

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions