0% found this document useful (0 votes)
25 views2 pages

Basic Operators and Operator Precedence (Cp1)

This Java program calculates an employee's net pay by deducting taxes and contributions from their gross pay. It takes the employee's name and gross pay as input, calculates deductions for withholding tax, SSS, Medicare, and Pag-IBIG contributions, and outputs the employee's name, gross pay, each deduction amount, and net pay.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

Basic Operators and Operator Precedence (Cp1)

This Java program calculates an employee's net pay by deducting taxes and contributions from their gross pay. It takes the employee's name and gross pay as input, calculates deductions for withholding tax, SSS, Medicare, and Pag-IBIG contributions, and outputs the employee's name, gross pay, each deduction amount, and net pay.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.util.

Scanner;

public class MyClass {

public static void main(String args[]) {

String name = "Jess Diaz";

double grossPay = 25000.0;

double withholdingTax = .15;

double sssC = .0363;

double mediCareC = .0125;

double pagibigC = 100;

double deductWT = grossPay*withholdingTax;

double deductsssC = grossPay*sssC;

double deductMC = grossPay*mediCareC;

System.out.println("Employee Name: " + name);

System.out.println("Gross Pay: " + grossPay);

System.out.println("______________________________________________");

System.out.println("Deductions: Amount: ");

System.out.println("Withholding Tax: " + deductWT);

System.out.println("SSS Contribution: " + deductsssC);

System.out.println("Medicare: " + deductMC);

System.out.println("Pagibig Contribution: " + pagibigC);

System.out.println("______________________________________________");

System.out.println("Net Pay: " +((grossPay)-


(deductWT+deductsssC+deductMC+pagibigC)));

You might also like