Advertisement
heysoul_sisypus

EmployeeClass

Jan 30th, 2023
565
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. package employee;
  2. import java.util.*;
  3. /**
  4.  *
  5.  * @author Ian
  6.  */
  7. public class EmployeeClass {
  8.  
  9.     public static void main(String args[]) {
  10.     Scanner Scan = new Scanner(System.in);    
  11.     Employee E1 = new Employee();
  12.     E1.getName();
  13.     System.out.print("Press F for Full-Time or P for Part-Time P: ");
  14.     String Choice = Scan.nextLine();
  15.    
  16.     if (Choice.equals("F")){
  17.      FullTimeEmployee F1 = new FullTimeEmployee();
  18.      System.out.println(" ");
  19.      F1.setMonthlySalary();
  20.      System.out.println("Name: "+E1.name);
  21.      System.out.println("Monthly Salary: "+String.format("%.2f", F1.monthlySalary));
  22.     return;
  23.     }
  24.     if (Choice.equals("P")){
  25.      PartTimeEmployee P1 = new PartTimeEmployee();
  26.      System.out.println(" ");
  27.      System.out.print("Enter rate per hour and number of hours worked separated by spaces: ");
  28.      P1.setWage();
  29.      System.out.println("Name: "+E1.name);
  30.      System.out.println("Wage: "+ String.format("%.2f", P1.wage));
  31.    
  32.     }
  33.     else {System.out.println("The letter is invalid");
  34.     }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement