Untitled
unknown
plain_text
a year ago
2.3 kB
3
Indexable
package comp_ptask1;
public class ComP_PTask1 {
public static void main(String[] args) {
//* Employee details
String employeeName = "Magdalena Leones";
byte workingDays = 21;
double monthlySalary = 35000;
double dailyRate = monthlySalary / workingDays; // 1600.667
//* Employee deduction statistics
int leaveCredits = 3;
int vacationDays = 5;
double lateMinutes = 30;
//* Deductions
double sssContributionPerc = 0.045; // 4.5%
byte pagIbigLateMonths = 2;
double pagIbigContribution = 200 * (pagIbigLateMonths + 1); // 200 per month
double withholdingTaxRate = 0.1; // 10%
//* Calculate deductions
int unpaidLeaveDays = vacationDays - leaveCredits;
double unpaidLeaveDeduction = unpaidLeaveDays * dailyRate;
double lateDeduction = (lateMinutes / (60 * 8)) * dailyRate;
double sssContribution = monthlySalary * sssContributionPerc;
double withholdingTax = monthlySalary * withholdingTaxRate;
double totalDeductions = sssContribution + pagIbigContribution + withholdingTax;
double grossPay = monthlySalary - unpaidLeaveDeduction - lateDeduction;
double netPay = grossPay - totalDeductions;
System.out.println(
"------------ Payslip ------------" + "\n" +
"EMPLOYEE NAME: " + employeeName + "\n\n" +
"GROSS PAY (₱" + String.format("%.2f", grossPay) + "):\n" +
" > Leave Deduction: ₱" + String.format("%.2f", unpaidLeaveDeduction) + "\n" +
" > Late Deduction: ₱" + String.format("%.2f", lateDeduction) + "\n\n" +
"DEDUCTIONS (₱" + String.format("%.2f", totalDeductions) + "): \n" +
" > SSS Contribution: ₱" + String.format("%.2f", sssContribution) + "\n" +
" > Pag Ibig Contribution: ₱" + pagIbigContribution + "(+" + pagIbigLateMonths + " months late) \n" +
" > Withholding Tax: ₱" + String.format("%.2f", withholdingTax) + "\n\n" +
"NET PAY: ₱" + String.format("%.2f", netPay) + "\n" +
"---------------------------------"
);
}
}
}
}
Editor is loading...
Leave a Comment