Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete Java code in BlueJ that does the following: Create an interface named :SalarySystem. The interface has an abstract method named: SalaryCalc (

Write a complete Java code in BlueJ that does the following:
Create an interface named :SalarySystem.
The interface has an abstract method named: SalaryCalc() to calculate the salary of a doctor in the hospital.
Create another interface named ExcellenceAward that has an abstract method ExcellenceAwardCalc() to
calculate the allowance for Excellence Award for doctors.
Create a class named Doctor that implements both interfaces: SalarySystem and ExcellenceAward.
a. Private attributes:
name (String),
Id(int)
YearsOfExperience (int)
NumOfSurgeries (int) to store the number of surgeries performed by the doctor.
Allowance(double) to store the allowance amount the doctor get from performing surgeries
Salary (double)
b. Constructor that only accepts id and name, YearsOfExperience, and NumOfSurgeries as parameters.
Make salary and allowance fixed to 0.
c. Override SalaryCalc() method in the SalarySystem interface as follows: Salary=YearsOfExperience *2000
d. Override ExcellenceAwardCalc() method in the interface ExcellenceAward as follows: Allowance=
NumOfSurgeries*1000
Create a class named Dentist that extends the Doctor class as follows:
a. Constructor that only accepts id and name, YearsOfExperience, and NumOfSurgeries as parameters.
b. Override SalaryCalc() method in the Doctor class as follows: Salary= YearsOfExperience **1500
COMP_214/Lab_Assignment/2023-2024/Second_Semester
Manal Zakri
Create a main method inside a class called Main to do the following:
a. Create an ArrayList doctors to add 3 doctors declared by the Doctor class.
b. Create another ArrayList dentists to add 3 dentists declared by the Dentist class.
c. Call the method ExcellenceAwardCalc() and SalaryCalc() of all doctors stored in the Arraylist, and
print out the results.
d. Call the method ExcellenceAwardCalc() and SalaryCalc() of all dentists stored in the Arraylist, and
print out the results.
image text in transcribed

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 Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago