Code:
class PayrollMo {
private String marital;
private double basicPay;
private double allowance;
private double overtime;
private double grossPay;
private double sss;
private double philhealth;
private double pagIbig;
private double tax;
private double deduction;
private double netPay;
private double percentage;
//set value para mamaya Hahaha
void setPercentage(){
if(this.marital == "Sl" ){
this.percentage = 0.10;
}else if(this.marital == "Hr"){
this.percentage = 0.08;
}else{
this.percentage = 0.06;
}
}
// mag set tayo nag value ng mga variable sa itaas
void setMarital(String marital){
this.marital = marital;
}
void setPay(double pay){
this.basicPay = pay;
}
void setAllowance(double allowance){
this.allowance = allowance;
}
void setOvertime(double overtime){
this.overtime = overtime;
}
// compute value na!
void computeGross(){
this.grossPay = this.allowance + this.overtime;
this.grossPay += this.basicPay;
}
void computeSss(){
this.sss = this.basicPay * 0.0737;
}
void computePhilhealth(){
this.philhealth = this.basicPay *0.015;
}
void computePagIbig(){
this.pagIbig = this.basicPay *0.02;
}
void computeTax(){
this.tax = this.grossPay * this.percentage;
}
void computeDeduction(){
this.deduction = this.tax + this.pagIbig;
this.deduction += this.philhealth + this.sss;
}
void computeNetPay(){
this.netPay = this.grossPay - this.deduction;
}
//print natin!
void printGross(){
System.out.print("GROSS PAY: ");
System.out.println(String.format("%.2f",grossPay));
}
void printSss(){
System.out.print("SSS: ");
System.out.println(String.format("%.2f",sss));
}
void printPhilhealth(){
System.out.print("PHILHEALTH: ");
System.out.println(String.format("%.2f",philhealth));
}
void printPagIbig(){
System.out.print("PAG-IBIG: ");
System.out.println(String.format("%.2f",pagIbig));
}
void printTax(){
System.out.print("WITH HOLDING TAX: ");
System.out.println(String.format("%.2f",tax));
}
void printDeduction(){
System.out.print("TOTAL DEDUCTION: ");
System.out.println(String.format("%.2f",deduction));
}
void printNetPay(){
System.out.print("NET PAY: ");
System.out.println(String.format("%.2f",netPay));
}
}
public class Sweldo {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
PayrollMo get = new PayrollMo ();
System.out.print("MARITAL STATUS: ");
String marital = input.nextLine();
System.out.print("NAME: ");
String name = input.nextLine();
System.out.print("ID : ");
int id = input.nextInt();
System.out.print("BASIC PAY: ");
double pay = input.nextDouble();
System.out.print("ALLOWANCE: ");
double allowance = input.nextDouble();
System.out.print("OVERTIME: ");
double overtime = input.nextDouble();
get.setPercentage();
get.setMarital(marital);
get.setPay(pay);
get.setAllowance(allowance);
get.setOvertime(overtime);
get.computeGross();
get.computeSss();
get.computePhilhealth();
get.computePagIbig();
get.computeTax();
get.computeDeduction();
get.computeNetPay();
get.printGross();
get.printSss();
get.printPhilhealth();
get.printPagIbig();
get.printTax();
get.printDeduction();
get.printNetPay();
}
}

medjo hindi pa pulido pero sample lang naman
. Galing to dito try lang naman
https://phcorner.org/threads/602948/#lg=thread-602948&slide=0
Good night!