Advertisement
InasAwad

Untitled

Nov 4th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     private  static Company company = new Company("ML2");
  6.     public static Scanner scanner = new Scanner (System.in);
  7.  
  8.  
  9.     public static void main(String[] args) {
  10.         addNewEmployee();
  11.     }
  12.  
  13.   public static void addNewEmployee(){
  14.       System.out.println("Please enter employee name: ");
  15.       String employeeName = scanner.nextLine();
  16.       System.out.println("Please enter employee title: ");
  17.       String employeeTitle = scanner.nextLine();
  18.       System.out.println("Please enter employee salary: ");
  19.       double salary = scanner.nextDouble();
  20.       Employee newEmployee = Employee.addEmployee(employeeName,employeeTitle,salary);
  21.         if (company.addNewEmployee(newEmployee)){
  22.             System.out.println("Employee name: " + employeeName + "\n" +  "Employee title: "
  23.                     + employeeTitle +  "\n"+ "employee salary: " + salary  ) ;
  24.         }else {
  25.             System.out.println("Employee details are already on file. ");
  26.         }
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement