Lunes, Agosto 19, 2013

LabExer#3

3. Class Name: Pay. The program calculates the user’s gross pay. It calculates the gross pay by multiplying the number of hours worked by hourly pay rate. Write a program that will ask the user to enter ratePerHour, hoursWorked, absences, and late, SSS=175+PhilHealth=300. Calculate the Gross, Net of an employee with the following formula specification:
a. RatePerHour - data from a user refers to hourly rate of a particular employee.
b. hoursWorked - data from a user refers to number of hours spent by an employee.
c. absences - data from a user which is define his number of absences. Every absence is 5.75
d. late - data from a user as number of idleness and tardiness of an employee. A late is 3.25.
e. Gross - Gross of an employee (ratePerHour*hoursWorked)
f. totalDeduction - total deductions of employee (absences+late+ SSS+PhilHealth).
g. Net Income - (ratePerHour*hoursWorked) – totalDeduction



import java.util.Scanner;

public class Pay {

    public static void main(String[] args) {
        Scanner amante=new Scanner(System.in);
       
        double USD=43.75,GBP=78.98,EUR=56.45,JPY=0.867;
       
        System.out.println("Enter rate per hour: ");
        double ratePerHour=amante.nextDouble();   
        System.out.println("Enter hours worked: ");
        double hoursWorked=amante.nextDouble();   
        System.out.println("Enter number of absences: ");
        double absences=amante.nextDouble();   
        System.out.println("Enter number of tardiness: ");
        double late=amante.nextDouble();   
       
        double gross=ratePerHour*hoursWorked;
        double totalAbsences=absences*5.75;
        double totalLate=late*3.25;
        double totalDeduction=(totalAbsences+totalLate+175+300);
        double NetIncome=gross-totalDeduction;       
       
       
        System.out.println("Gross: "+gross+"\nTotal Deduction: "+totalDeduction+"\nNet Income: "+NetIncome);
    }
}

Walang komento:

Mag-post ng isang Komento