Hi guys, I'm having trouble with this JAVA assingment we got at school and a friend recommended this forum for me... It's pretty basic, but I'm a bit , becouse we did this stuff like 5 months ago, and I have forgotten most of it...at first I tought it was a GUI assignment, so I did everything in GUI, but then the teacher said we're not supposed to do it that way.
Anyway...I've asked her for help, but she said, just do this and that and you add this and that's it ..I have no idea what she was talking about.
We're using Jens Editor and we're supposed to use ReadKb to get input from the user and than display information.
So this is the assingment:
It's got two parts.
Create a class using Java that calculates and displays the gross and net pay of an employee based on the data entered by the user.
When designing your class ensure you address the following points:
* Name the class EmployeePayroll
* The class is to contain fields to record the employee’s first name, last name, ID, hours worked, hourly pay rate, gross pay, and net pay.
* The class is to include a default constructor used to initialise the fields for first name, last name, and ID to empty strings; hours worked and pay rate to zero.
* The class is to include a second constructor that accepts values for first name, last name, ID, hours worked, and pay rate and initialises their corresponding field values accordingly.
* Each field should have its own getter method that returns its value.
* Setter methods are required for the first name, last name, ID, hours worked, and pay rate fields.
* Separate methods are necessary to calculate gross pay and net pay using the supplied formulas. Neither of these methods returns a value.
* A method is required to display an employee’s payslip, containing all their details including gross and net pay. This method should call on the appropriate getter methods to access the employee’s details.
* Tax rate is a fixed value of 42% (0.42).
* Use of appropriate code comments.
I have absolutly no idea where to start, I can't remember how we used to do this (we did simple version of this before. but I can't find the project files anywhere on my pc, I think they got wiped from the school computer somehow. )
They gave us these formulas to work with:
For employees who have worked up to 38 hours:
gross pay = hours worked * pay rate
For employees who have worked up to 42 hours:
gross pay = 38 * pay rate + (hours worked – 38) * 1.5 * pay rate
For employees who have worked up to 60 hours:
gross pay = 38 * pay rate + 4 * 1.5 * pay rate + (hours worked – 42) * 2 * pay rate
net pay = gross pay – (gross pay * tax rate)
Create a class to test the functionality of your EmployeePayroll class.
When designing this class ensure you address the following points:
* Name the class TestEmployeePayroll
* Instantiate one EmployeePayroll object that initially sets the first name, last name, and ID fields to your name and student number, the pay rate field to 20.00 and the hours worked field to 38.0.
* Instantiate a second EmployeePayroll object using the default constructor.
* Instantiate an object of the ReadKb class so that your test class can receive user input from the keyboard.
* User input is required for first name, last name, ID, hours worked and pay category (see following table)
* Validation is required for user input of hours worked (must be between 0 and 60 inclusively) and pay category (must be between 1 and 4 inclusively). Assume the user will enter only numeric input for these values.
* The values entered by the user are to be assigned to the fields of the second EmployeePayroll object using the appropriate setter methods.
* Calculate gross and net pay for each EmployeePayroll object.
* Display a pay slip for each employee.
* Use of appropriate code comments.
Use a switch statement to allocate employee pay rate based on the entered pay category value.
If anyone can help, I would be immensely grateful.