Revision: 34003
Updated Code
at November 19, 2010 20:23 by trusktr
Updated Code
import java.io.*; public class PayrollApp { // Data Objects ( private Employees empTable; private static final MyString REPORT_HEADER_A = new MyString("Employee Pay Hours Gross Tax Net"); private static final MyString REPORT_HEADER_B = new MyString("Name Rate Worked Pay Amount Pay"); private static final MyString REPORT_HEADER_C = new MyString("====================== ======== ========== ========== ========== =========="); private static final MyString WORD_TOTALS = new MyString("Totals:"); private static final MyString WORD_AVERAGES = new MyString("Averages:"); // ) // Constructors ( public PayrollApp() { empTable = new Employees(); } public PayrollApp(HourlyEmployee e) { empTable = new Employees(e); } public PayrollApp(PiecedEmployee e) { empTable = new Employees(e); } public PayrollApp(SalariedEmployee e) { empTable = new Employees(e); } public PayrollApp(Employees e) { empTable = e; } public PayrollApp(File file) { empTable = new Employees(file); } // ) // Accessors ( public Employees getEmps() { return new Employees(empTable); } // ) // Mutators ( public MyString tableHeader() { return new MyString(" " + REPORT_HEADER_A + "\n " + REPORT_HEADER_B + "\n " + REPORT_HEADER_C); } public MyString[] tableRows() { MyString[] rows = new MyString[empTable.size()]; for (int i=0; i<empTable.size(); i++) { HourlyEmployee e = (HourlyEmployee)empTable.employee(i); rows[i] = new MyString(" " + e.formattedName().left(22) + " " + e.payRate().myString(2).right(8) + " " + e.hours().myString(2).right(10) + " " + e.grossPay().myString(2).right(10) + " " + e.taxAmount().myString(2).right(10) + " " + e.netPay().myString(2).right(10)); } return rows; } public Number totalPayRate() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (((HourlyEmployee)empTable.employee(i)).payRate()); } return total; } public Number totalHours() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (((HourlyEmployee)empTable.employee(i)).hours()); } return total; } public Number totalGross() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (empTable.employee(i).grossPay()); } return total; } public Number totalTax() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (empTable.employee(i).taxAmount()); } return total; } public Number totalNet() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (empTable.employee(i).netPay()); } return total; } public Number avgPayRate() { return totalPayRate() .over (empTable.size()); } public Number avgHours() { return totalHours() .over (empTable.size()); } public Number avgGross() { return totalGross() .over (empTable.size()); } public Number avgTax() { return totalTax() .over (empTable.size()); } public Number avgNet() { return totalNet() .over (empTable.size()); } public MyString totalsRow() { return new MyString(" " + WORD_TOTALS.left(22) + " " + totalPayRate().myString(2).right(8) + " " + totalHours().myString(2).right(10) + " " + totalGross().myString(2).right(10) + " " + totalTax().myString(2).right(10) + " " + totalNet().myString(2).right(10)); } public MyString averagesRow() { return new MyString(" " + WORD_AVERAGES.left(22) + " " + avgPayRate().myString(2).right(8) + " " + avgHours().myString(2).right(10) + " " + avgGross().myString(2).right(10) + " " + avgTax().myString(2).right(10) + " " + avgNet().myString(2).right(10)); } // ) }
Revision: 34002
Updated Code
at November 19, 2010 20:22 by trusktr
Updated Code
import java.io.*; public class PayrollApp { // Data Objects ( private Employees empTable; private static final MyString REPORT_HEADER_A = new MyString("Employee Pay Hours Gross Tax Net"); private static final MyString REPORT_HEADER_B = new MyString("Name Rate Worked Pay Amount Pay"); private static final MyString REPORT_HEADER_C = new MyString("====================== ======== ========== ========== ========== =========="); // Amberlicious, Angelica 14.25 59.25 981.47 147.22 834.25 private static final MyString WORD_TOTALS = new MyString("Totals:"); private static final MyString WORD_AVERAGES = new MyString("Averages:"); // ) // Constructors ( public PayrollApp() { empTable = new Employees(); } public PayrollApp(String f, String l, double pr, double hrs) { empTable = new Employees(f, l, pr, hrs); } public PayrollApp(MyString f, MyString l, Number pr, Number hrs) { empTable = new Employees(f, l, pr, hrs); } public PayrollApp(EmployeeData d) { empTable = new Employees(d); } public PayrollApp(Employee e) { empTable = new Employees(e); } public PayrollApp(Employees e) { empTable = e; } public PayrollApp(File file) { empTable = new Employees(file); } // ) // Accessors ( public Employees getEmps() { return new Employees(empTable); } // ) // Mutators ( public MyString tableHeader() { return new MyString(" " + REPORT_HEADER_A + "\n " + REPORT_HEADER_B + "\n " + REPORT_HEADER_C); } public MyString[] tableRows() { MyString[] rows = new MyString[empTable.size()]; for (int i=0; i<empTable.size(); i++) { Employee e = empTable.employee(i); rows[i] = new MyString(" " + e.formattedName().left(22) + " " + e.payRate().myString(2).right(8) + " " + e.hours().myString(2).right(10) + " " + e.grossPay().myString(2).right(10) + " " + e.taxAmount().myString(2).right(10) + " " + e.netPay().myString(2).right(10)); } return rows; } public Number totalPayRate() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (empTable.employee(i).payRate()); } return total; } public Number totalHours() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (empTable.employee(i).hours()); } return total; } public Number totalGross() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (empTable.employee(i).grossPay()); } return total; } public Number totalTax() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (empTable.employee(i).taxAmount()); } return total; } public Number totalNet() { Number total = new Number(); for (int i=0; i<empTable.size(); i++) { total = total .plus (empTable.employee(i).netPay()); } return total; } public Number avgPayRate() { return totalPayRate() .over (empTable.size()); } public Number avgHours() { return totalHours() .over (empTable.size()); } public Number avgGross() { return totalGross() .over (empTable.size()); } public Number avgTax() { return totalTax() .over (empTable.size()); } public Number avgNet() { return totalNet() .over (empTable.size()); } public MyString totalsRow() { return new MyString(" " + WORD_TOTALS.left(22) + " " + totalPayRate().myString(2).right(8) + " " + totalHours().myString(2).right(10) + " " + totalGross().myString(2).right(10) + " " + totalTax().myString(2).right(10) + " " + totalNet().myString(2).right(10)); } public MyString averagesRow() { return new MyString(" " + WORD_AVERAGES.left(22) + " " + avgPayRate().myString(2).right(8) + " " + avgHours().myString(2).right(10) + " " + avgGross().myString(2).right(10) + " " + avgTax().myString(2).right(10) + " " + avgNet().myString(2).right(10)); } // ) }
Revision: 34001
Updated Code
at October 15, 2010 20:54 by trusktr
Updated Code
public class PayrollApp { // Data Objects ( private Employees empTable; private static final MyString REPORT_HEADER_A = new MyString(); private static final MyString REPORT_HEADER_B = new MyString(); private static final MyString REPORT_HEADER_C = new MyString(); // ) // Constructors ( public PayrollApp() { empTable = new Employees(); } public PayrollApp(String f, String l, double pr, double hrs) { empTable = new Employees(f, l, pr, hrs); } public PayrollApp(MyString f, MyString l, Number pr, Number hrs) { empTable = new Employees(f, l, pr, hrs); } public PayrollApp(EmployeeData d) { empTable = new Employees(d); } public PayrollApp(Employee e) { empTable = new Employees(e); } public PayrollApp(Employees e) { empTable = e; } // ) // Accessors ( // ) // Mutators ( public String toString() { return " "; } public MyString[] tableRows() { MyString[] rows = new MyString[empTable.size()]; for (int i=0; i<empTable.size(); i++) { Employee e = empTable.employee(i); rows[i] = new MyString("" + e.formattedName().left(20) + " " + e.payRate().myString().right(10) + " " + e.hours().myString().right(10) + " " + e.grossPay().myString().right(10) + " " + e.taxAmount().myString().right(10) + " " + e.netPay().myString().right(10)); } return rows; } calcTotals(count, total_payrate, payrate, total_hours, hours, total_grosspay, grosspay, total_taxamount, taxamount, total_netpay, netpay, totals) { } // calcAverages(avg_payrate, total_payrate, count, avg_hours, total_hours, avg_grosspay, total_grosspay, avg_taxamount, total_taxamount, avg_netpay, total_netpay, averages); // totals_averages(totals, total_payrate, total_hours, total_grosspay, total_taxamount, total_netpay, averages, avg_payrate, avg_hours, avg_grosspay, avg_taxamount, avg_netpay); // ) }
Revision: 34000
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 15, 2010 20:52 by trusktr
Initial Code
public class PayrollApp { // Data Objects ( private Employees empTable; private static final MyString REPORT_HEADER_A = new MyString(); private static final MyString REPORT_HEADER_B = new MyString(); private static final MyString REPORT_HEADER_C = new MyString(); // ) // Constructors ( public PayrollApp() { empTable = new Employees(); } public PayrollApp(String f, String l, double pr, double hrs) { empTable = new Employees(f, l, pr, hrs); } public PayrollApp(MyString f, MyString l, Number pr, Number hrs) { empTable = new Employees(f, l, pr, hrs); } public PayrollApp(EmployeeData d) { empTable = new Employees(d); } public PayrollApp(Employee e) { empTable = new Employees(e); } public PayrollApp(Employees e) { empTable = e; } // ) // Accessors ( // ) // Mutators ( public String toString() { return " "; } public MyString[] tableRows() { MyString[] rows = new MyString[empTable.size()]; for (int i=0; i<empTable.size(); i++) { Employee e = empTable.employee(i); rows[i] = new MyString("" + e.formattedName().left(20) + " " + e.payRate().myString().right(10) + " " + e.hours().myString().right(10) + " " + e.grossPay().myString().right(10) + " " + e.taxAmount().myString().right(10) + " " + e.netPay().myString().right(10)); } return rows; } calcTotals(count, total_payrate, payrate, total_hours, hours, total_grosspay, grosspay, total_taxamount, taxamount, total_netpay, netpay, totals) { } // calcAverages(avg_payrate, total_payrate, count, avg_hours, total_hours, avg_grosspay, total_grosspay, avg_taxamount, total_taxamount, avg_netpay, total_netpay, averages); // totals_averages(totals, total_payrate, total_hours, total_grosspay, total_taxamount, total_netpay, averages, avg_payrate, avg_hours, avg_grosspay, avg_taxamount, avg_netpay); // ) }
Initial URL
Initial Description
Initial Title
cisp401 PayrollApp.java
Initial Tags
java
Initial Language
Java