Advertisement
angeloeboy10

Java Code

Dec 7th, 2020
720
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.03 KB | None | 0 0
  1. package com.company;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner inp = new Scanner(System.in);
  8.         String employeeName, pfTime;
  9.         double basicPay;
  10.  
  11.         System.out.print("Enter Employee Name: ");
  12.         employeeName = inp.nextLine();
  13.  
  14.         System.out.print("Press F for Full time or P for Part time: ");
  15.         pfTime = inp.nextLine();
  16.  
  17.         if(pfTime.equalsIgnoreCase("F")){
  18.  
  19.  
  20.             System.out.println("-------Full Time Employee-------");
  21.             System.out.print("Enter Basic Pay: ");
  22.             basicPay = inp.nextDouble();
  23.  
  24.             System.out.println("--------------------------------");
  25.             System.out.println("Employee Name: " + employeeName);
  26.             System.out.println("Basic Pay: " + basicPay );
  27.             System.out.println("\n--------------------------------");
  28.             System.out.println("Gross Pay: " + basicPay);
  29.  
  30.         }else if(pfTime.equalsIgnoreCase("p")){
  31.             double ratePerHour, overTimePay, grossPay;
  32.             int noOfHours, noOfOvertime;
  33.  
  34.             System.out.println("-------Part Time Employee-------");
  35.             System.out.print("Enter rate per hour: ");
  36.             ratePerHour = inp.nextDouble();
  37.  
  38.             System.out.print("Enter no. of hours worked: ");
  39.             noOfHours = inp.nextInt();
  40.  
  41.             System.out.print("Enter no. of overtime: ");
  42.             noOfOvertime = inp.nextInt();
  43.  
  44.             basicPay = ratePerHour * noOfHours;
  45.             overTimePay = noOfOvertime * (ratePerHour * 1.25);
  46.             grossPay = basicPay + overTimePay;
  47.             System.out.println("---------------------------------");
  48.             System.out.println("Employee Name: " + employeeName);
  49.             System.out.println("Basic Pay: " + basicPay);
  50.             System.out.println("Overtime Pay: " + overTimePay);
  51.             System.out.println("\n---------------------------------");
  52.             System.out.println("Gross Pay: " + grossPay);
  53.  
  54.         }
  55.     }
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement