Question: Use NetBeans IDE 8.2+ Need help with creating code for this intructions and most of all please include comments on how you understood it, I
Use NetBeans IDE 8.2+
Need help with creating code for this intructions and most of all please include comments on how you understood it, I cannont understand this instuctions. Like the netamount and others do i add them before the loop and then I add each elemnt of the array to contain each of the parameters to for loop during the iteration, or do i use them from phase 1, althguht they should be private parameters in phase 1.
You can use this link for phase 1, as it might be easier to understand instructions with knowing what pahse 1 looks like.
http://www.chegg.com/homework-help/questions-and-answers/program-represents-simple-payroll-system-could-hypothetically-used-company-maintain-inform-q26671149?trackid=7c83bc7b&strackid=7735db82&ii=6
This is what needs to be done.
Please follow the instructions below:
1- Download from moodle the solution I posted for the project.
2- Add a new class called PayrollSystem_Phase2.
3- Add the main method provided below.
4- Add another method called parseEmployeePaychecks that has two parameters: one of type int and one of type String. The method returns an ArrayList of Paycheck elements.
The int parameter represents an employee id, whereas the String parameter represents the list of paychecks the employee has received and which the method converts to an ArrayList of Paycheck elements.
5- You may assume that the String parameter has the following format:
periodBeginDate1:periodEndDate1:grossAmount1:taxAmount1:bonusAmount1# periodBeginDate2:periodEndDate2:grossAmount2:taxAmount2:bonusAmount2#...
6- Im providing you with an algorithm for the method below:
public static ArrayList
{
/*
1- Declare an ArrayList of Paycheck elements and initialize to an empty list.
2- Split the paycheckData parameter on the # to get each paycheck information.
3- Write a loop to iterate through the list of paycheck strings, which should have the following format: periodBeginDate:periodEndDate:grossAmount:taxAmount:bonusAmount
4- Calculate the netAmount to be: grossAmount taxAmount + bonusAmount
5- Create a Paycheck object using the employee id passed in the first parameter and the data parsed from the second parameter.
6- Add the Paycheck object to the ArrayList that this method returns.
7- After the loop, return the ArrayList of Paycheck objects.
*/
}
public static void main(String args[])
{
String paycheckData = "01/22/2018:01/26/2018:2500.50:375.25:50#" +
"01/29/2018:02/02/2018:2430.50:370.75:25#" +
"02/05/2018:02/09/2018:2630.50:380.25:60";
ArrayList
for(Paycheck checkElement: empPaychecks)
{
System.out.println(checkElement.toString());
}
}
Executing the main method should print the following to the output console:
run:
Employee ID: 1
Period Begin Date: 01/22/2018
Period End Date: 01/26/2018
Gross Amount: 2500.5
Tax Amount: 375.25
Bonus Amount: 50.0
Net Amount: 2175.25
-------------------------------
Employee ID: 1
Period Begin Date: 01/29/2018
Period End Date: 02/02/2018
Gross Amount: 2430.5
Tax Amount: 370.75
Bonus Amount: 25.0
Net Amount: 2084.75
-------------------------------
Employee ID: 1
Period Begin Date: 02/05/2018
Period End Date: 02/09/2018
Gross Amount: 2630.5
Tax Amount: 380.25
Bonus Amount: 60.0
Net Amount: 2310.25
-------------------------------
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
