Question: QUESTION 1 There is a small restaurant owner asks you to develop a simple payroll system for its staffs. The system will calculate the net



QUESTION 1 There is a small restaurant owner asks you to develop a simple payroll system for its staffs. The system will calculate the net salary for his staffs. The diagram below shows a UML class diagram of the payroll system that consists of three classes namely MainMenu, Staff, and Chef. The system will deal only the staff position of waiter and chef. PackageA Staff Main Menu - name : String - daysWorked int - payRate: double - house Allowance : double - EPF Contribution: double - basicSalary: double - netSalary: double + Staff(String name, int daysWorked, double payRate, double houseAllowance) + getName(): String getDaysWorked(): int + getPayRate(): double getHouseAllowance(): double getEPF Contribution(): double + getBasicSalary): double + calculateBasicSalary): void + calculate EPFContribution() : void + calculateNetSalary(): double + toString(): String + main(String[] args) : void extends Chef - cooking Allowance : double + Chef(String name, int daysWorked, double pay Rate, double house Allowance, double cooking Allowance) + toString(): String + calculateNetSalary(): double You are required to develop the system based on the following information: 1. Write the definition for all classes in the package PackageA. 2. Create the Staff class that consists of a constructor and instance variables and methods. The detail information for some methods are as follows: a. A constructor - used to store staff information into an object b. Getter methods - used to retrieve the data/value from private instance variables c. calculateBasicSalary() method - used to calculate the basic salary which number of days worked * pay rate per day. d. calculateEPFContribution () method used to calculate the Employees Provident Fund (EPF) contribution (or Kumpulan Wang Simpanan Pekerja (KWSP)) which 9% is imposed on the staff's basic salary. e. calculateNet Salary() method - used to calculate the net salary which basic salary + house allowance -EPF contribution f. toString() method used to display all the staff information (refer to all private instance variables) 3. Create the Chef class that consists of a constructor and instance variable and methods. The detail information for some methods are as follows: a. A constructor with 5 parameters - used to store staff information into an object b. calculateNet Salary() method - used to calculate the net salary which basic salary + house allowance -EPF contribution + cooking allowance you can use super() to call certain method in the Staff class c. toString() method - used to display all the staff including cooking allowance 4. Create the MainMenu class that consists of the main() method. This class will communicate with the class Staff and Chef. The detail information in the method are as follows: a. You are required to create an object of waiter/staff and chef respectively with the information as you can get from the output below (hint: you do not need to input data interactively) The sample objects are: Staff waiter = new Staff (...); Chef chef = new Chef (...); b. Display an output as below Name = Kamal Hassan Nom of days worked = 25 Pay rate Per Day 50.0 Basic Salary 1250.0 House Allowance = 350.0 EPF Contribution = 112.5 Net Salary = 1487.5 = Name = Jamal Husin Nom of days worked = 25 Pay rate Per Day = 150.0 Basic Salary = 3750.0 House Allowance = 500.0 Cooking Allowance = 350.0 EPF Contribution = 337.5 Net Salary = 4262.5 BUILD SUCCESSFUL (total time: 0 seconds) QUESTION 2 Based on your creativity, implement the above system that consist of concrete classes and an interface (interface is a compulsory). You can create a class/classes if required. The output must be same as above. Save all those classes and interface in a different package namely PackageB
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
