5/5 – (6 votes)
This assignment focuses on programming basics; expressions, variables, constants, the use of loops and if-statements.
LogicFoo Limited needs a program to calculate how much to pay their casual employees who are paid on an hourly basis. The Australian Department of Employment stipulates that employees should be paid time and a half for any hours over 40 that they work in a single week. In addition, LogicFoo is required to deduct income tax from each employee at a fixed Income Tax Rate set at 15%. For example, if an employee works 45 hours, they get 5 hours of overtime, at 1.5 times their base pay. The department requires that hourly employees be paid at least $18.00 an hour. LogicFoo Limited requires that an employee not work more than 60 hours in a week.
An employee gets paid (hours worked) (base pay), for each hour up to 40 hours. For every hour over 40, they get overtime = (base pay) 1.5. The base pay must not be less than the minimum wage ($18.00 an hour), if it is, the program should print an error. And if the number of hours is greater than 60, the program should also print an error message.
Task Requirements
Create a new class called MITnnnnnLogicFoo were MITnnnnn is your MIT student ID.
Include documentation before the start of the class to include your name, ID and a description of the program
Include a main method
Inside the main method declare and initialise the variables; base pay and hours worked.
Other variables should include gross pay, overtime, net pay and pay you as gain.
Include if statements that check for base pay and the limit of 60 hours in a week and prints to the console the respective error messages.
Include statements to calculate overtime, gross pay, pay as you go and net pay
LogicFoo Ltd ABN:55135151115133
Pay Slip for: Employee 2 Payment Date: 25/08/2017
Pay Period from: 14/08/2017 to 23/08/2017 Gross Pay: $919.10
Net Pay: $781.23
Description Hours Worked Calculated Rate Type
Base Hourly @$18.20 40 $728.00 Wages
Overtime @$27.3 7 $191.1 Wages
PAYG Withholding $-137.87 Tax
Include statements that print to the console a payslip for an employee using the example shown below.
Base PayHours WorkedEmployee 1$17.5035Employee 2$18.2047Employee 3$20.0073
Hint
Do not try to write the entire program in one go. It is much easier to write a small piece and test it, then write another small piece and test it. For example, start by writing just a skeleton of your method and your main program. Then add the code to do the normal salary computation, without any special rules. Then add each additional rule, one at a time. You should test your program with simple test inputs to check that you handle each case.
Reviews
There are no reviews yet.