Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 3 One IT Solution Sdn Bhd is a software house company. They are planning to provide a system to store data about teachers. Given

image text in transcribedimage text in transcribed

QUESTION 3 One IT Solution Sdn Bhd is a software house company. They are planning to provide a system to store data about teachers. Given are School Teacher and Kindergarten Teacher subclasses which are inherited from Teacher superclass. Superclass: Teacher Attributes: String name; String icNo; // identification card no String subject Taught; // English, Math, History int yos; // year of service Methods: normal constructor accessor methods toString() abstract double calcSalary() Subclass: School Teacher Attributes: String grade; //teacher grade, e.g: DG41, DG44, DG48 Methods: normal constructor accessor method toString() double calcSalary() Subclass: Kindergarten Teacher Attributes: int otHours; //overtime hours per month Methods: normal constructor accessor method toString() double calcSalary() a) Write the normal constructor for subclass School Teacher. (2 marks) b) Write the definition of method calesalary() for both subclasses that calculate and retum the teacher's salary based on the following information. 1) The salary of school teacher is calculated based on the grade as shown in Table 1: Table 1: School Teacher Salary Grade Salary (RM) DG41 2000 DG44 3400 DG48 5000 DG52 5600 ii) For kindergarten teachers, the salary is calculated based on the year of service as shown in Table 2 and overtime hours. Table 2 Kindergarten Teacher Salary Year of Service Basic salary (RM) 5 2100 Each overtime hour will be paid RM15. Salary for the kindergarten teachers is the total of basic salary and overtime hours pay. (6.5 marks) c) Based on the classes given, write Java statements to do the following: 0) Declare an array of 20 Teacher objects named teach. (1 mark) 1) Display the information of English teachers who have been teaching for more than 10 years. (3 marks) ii) Display the name and salary of school teachers whose grade is DG44. (3.5 marks) iv) Calculate and display the total overtime hours done by the teachers. (4 marks)

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

Students also viewed these Databases questions