What's new

HELP!!

hamtaro

Grasshopper
Joined
Dec 14, 2021
Posts
1
Reaction
0
Points
12
*** Define an abstract class named Employee which has the following data members:

· integer employee id

· string name

· double salary

· double deduction

and methods:

· 2 constructors (one with no parameter and the other accepts 2 parameters – employee id and name)

· Setter/getter methods for each data member

· display method which displays the 3 data members (id,name,salary)

· abstract calculateSalary which computes the salary of the employee and returns a double value (this method accepts one parameter of type double which represents the number of days worked in a month)

· abstract calculateDeduction which computes the total deductions of an employee in a month and returns a double value (this method does not accept any parameter)

· abstract calculateNetPay which computes the net pay of an employee and returns a double value. This method does not accept any parameter.



***Define a class for Doctor which is a derived class of employee. This class defines one property which is String specialization. The methods of this class include:

· a constructor which accepts 3 parameter (2 from Employee and String specialization) and must invoke the constructor of the parent class and sets appropriate values

· setter/getter method for the specialization data member

· an overloaded display method which displays the employee id, name, salary and field of specialization of the doctor

· an overridden calculateSalary method which computes the salary of an employee based on the following specifications:

Field of Specialization Daily Rate

Pediatrician 2050

Ob-Gynecologist 2650

Neurologist 6575

Salary is calculated by multiplying the daily rate by the numbers of days worked in a month. Set the salary of the employee to the value computed. (In this part, invoke the setSalary method of the parent class)

· an overridden calculateDeduction method which computes the deduction of an employee in a month based on the salary computed. To start the calculation, call the method calculateSalary and store the value to a variable of type double. The deductions are based on the following specifications:

Salary SSS Pag-ibig WTAX PhilHealth

<=10000 3% 2% 5% 1%

10000&<=20000 5% 4% 10% 2.5%

20000&<=30000 7% 7% 15% 5%

30000 10% 10% 30% 8%

***Define a class Programmer which is a derived class of Employee. This class defines one property of type string which represents the programming language specialized by the programmer. The methods of this class include:

· 2 constructors (one with no parameters and the other accepts 3 parameters, 2 of which are to be passed to the constructor of the parent class)

· setter/getter method for the data member

· an overridden display method which displays the employee id, name, salary and field of specialization of the doctor

an overridden calculateSalary method which calculates salary by multiplying the days worked 950 as the daily rate. Set the salary of the employee to the value computed. (In this part, invoke the setSalary method of the parent class)

· an overridden calculateDeduction method which computes deduction based on the following:

o SSS 5% of the salary

o Pag-ibig 3% of the salary

o WTAX 8% of the salary

o PhilHealth 3% of the salary

· an overridden calculateNetPay which computes the net pay of an employee by subtracting the total deductions from the salary computed.





***Define a class named TestClass which tests the functionality of the 2 derived classes. The test class works as follows:

§ Create an object for the class Doctor and Programmer

§ In each class, ask the user for inputs which corresponds to the data members for each object. For instance, for the class Doctor, ask for 5 user inputs which represent employee id, name, specialization and the number of days worked in a month. The first 3 parameters are passed to the constructor upon creating the object. The number of days worked is the parameter needed for the calculateSalary method.

§ Invoke the display method of each class to display all information about the employee

§ Sample output is shown in the next page:



















MAIN MENU

[1] Doctor

[2] Programmer

[3] Exit



If the user chooses 1, the sample output is:

Enter ID Number : 001

Enter Name : Juan dela Cruz

Enter Field of Specialization : Pediatrician

Number of days worked : 15 <NOTE: days must not exceed 30 days>



//in this part, the display method is invoked

Doctor’s Information:

ID 001

Name Juan dela Cruz

Specialization Pediatrician

Salary 15750.00

Deduction 3386.25

Net Pay 12363.75







If the user chooses 2, the sample output is

Enter ID Number : 001

Enter Name : Juan dela Cruz

Enter Field of Specialization : Java

Number of days worked : 15 <NOTE: days must not exceed 30 days>



//in this part, the display method is invoked

Programmer’s Information:

ID 001

Name Juan dela Cruz

Specialization Pediatrician

Salary 14250

Deduction 2707.50

Net Pay 11542.50
 
magaling nagpa assignment nito ah. saang school to TS? kung teacher mo mismo gumawa netong instruction, magaling sya. mahirap to sa beginner.
 

Similar threads

Back
Top