Question 2:
A Technology Software Company (TSC) would like to have a system that will calculate a gross salary and a bonus for their employee. Thus, you have been assigned to develop a system that required staff number and salary as an input to the system. The program will loop until the user press “N” to stop the program. The bonus is calculate based on the following table:
Salary (RM) Bonus Rate
< 500.00 0%
500.00 – 1000.00 15%
1001.00 – 2000.00 10%
2001.00– 3000.00 8%
>3001.00 5%
The sample of the output are as follow:
Enter a staff number : 1111
Enter a salary (RM) : 1000.00
Your bonus is : 150.00
Your gross salary is : 1150.00
Any more data : Y / N : Y
==================================
Enter a staff number : 2222
Enter a salary (RM) : 2500.00
Your bonus is : 200.00
Your gross salary is : 2700.00
Any more data : Y / N : N
===================================
Thank you
The following is the UML class diagram in order to help you to write a code.
Staff
- staffNo
- salary
- bonus
+ Staff()
+ Staff(int,double,double)
+ getStaffNo(): int
+ getSalary() : double
+ getBonus() : double
+ getGrossSalary():double
Requirement:
1. You are required to use at least FOUR (3) methods AND ONE (or more) of them is method that return a value.
2. Use an appropriate variable name.
3. Use a looping statement (while or do..while)