Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner inp = new Scanner(System.in);
- String employeeName, pfTime;
- double basicPay;
- System.out.print("Enter Employee Name: ");
- employeeName = inp.nextLine();
- System.out.print("Press F for Full time or P for Part time: ");
- pfTime = inp.nextLine();
- if(pfTime.equalsIgnoreCase("F")){
- System.out.println("-------Full Time Employee-------");
- System.out.print("Enter Basic Pay: ");
- basicPay = inp.nextDouble();
- System.out.println("--------------------------------");
- System.out.println("Employee Name: " + employeeName);
- System.out.println("Basic Pay: " + basicPay );
- System.out.println("\n--------------------------------");
- System.out.println("Gross Pay: " + basicPay);
- }else if(pfTime.equalsIgnoreCase("p")){
- double ratePerHour, overTimePay, grossPay;
- int noOfHours, noOfOvertime;
- System.out.println("-------Part Time Employee-------");
- System.out.print("Enter rate per hour: ");
- ratePerHour = inp.nextDouble();
- System.out.print("Enter no. of hours worked: ");
- noOfHours = inp.nextInt();
- System.out.print("Enter no. of overtime: ");
- noOfOvertime = inp.nextInt();
- basicPay = ratePerHour * noOfHours;
- overTimePay = noOfOvertime * (ratePerHour * 1.25);
- grossPay = basicPay + overTimePay;
- System.out.println("---------------------------------");
- System.out.println("Employee Name: " + employeeName);
- System.out.println("Basic Pay: " + basicPay);
- System.out.println("Overtime Pay: " + overTimePay);
- System.out.println("\n---------------------------------");
- System.out.println("Gross Pay: " + grossPay);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement