0% found this document useful (0 votes)
3 views

Question 3

This Java program calculates the net salary based on the gross salary input by the user. It applies deductions for tax, PhilHealth, and Pag-Ibig if the gross salary exceeds 25,000. The program then outputs the gross salary, individual deductions, total deductions, and the resulting net salary.

Uploaded by

brenttbada18
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Question 3

This Java program calculates the net salary based on the gross salary input by the user. It applies deductions for tax, PhilHealth, and Pag-Ibig if the gross salary exceeds 25,000. The program then outputs the gross salary, individual deductions, total deductions, and the resulting net salary.

Uploaded by

brenttbada18
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

package netsal;

import java.util.Scanner;
class wdwdw {

public static void main(String[]args) {


Scanner scanner = new Scanner(System.in);

System.out.println("Enter the Gross Salary: ");


double grossSalary = scanner.nextDouble();
double tax = 0, philHealth = 0, pagIbig = 0, totalDeductions = 0,
netSalary = 0;

if(grossSalary > 25000) {


tax = grossSalary * 0.02;
philHealth = grossSalary * 0.01;
pagIbig = grossSalary * 0.01;
totalDeductions = tax + philHealth + pagIbig;
}
netSalary = grossSalary - totalDeductions;

System.out.println("Gross Salary: " + grossSalary);


System.out.println("Tax Deduction: " + tax);
System.out.println("PhilHealth Deduction: " + philHealth);
System.out.println("Pag-Ibig Deduction: " + pagIbig);
System.out.println("Total Deductions: " + totalDeductions);
System.out.println("Net Salary: " + netSalary);

}
}

You might also like