Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Iterator;
- import java.util.*;
- import java.io.*;
- public class payrollMain {
- public ArrayList<DataEmployee> DateEmployeeArray = new ArrayList<DataEmployee>();
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("[1]Admin\n[2]Staff\n[3]Log out");
- System.out.print("Enter choice:");
- int choice = sc.nextInt();
- switch(choice){
- case 1:
- while(true){
- try{
- System.out.print("Username:");
- String name = sc.next();
- System.out.print("Password:");
- String pass = sc.next();
- if(name.equalsIgnoreCase("admin") && pass.equalsIgnoreCase("admin")){
- System.out.print("Authentication Successful");
- while(true){
- System.out.println(" OLS COMPANY ");
- System.out.println(" RECORD ");
- System.out.println("\n[1]DTR\n[2]Payroll");
- System.out.println("\n[3]Add\n[4]Search\n[5]Edit\n[6]Delete\n[7]Logout");
- System.out.println("");
- System.out.print("Enter choice:");
- choice = sc.nextInt();
- switch(choice){
- case 1:
- System.out.println("DTR");
- break;
- case 2:
- System.out.println();
- System.out.println("PAYROLL");
- break;
- case 3: //add
- Admin.addEmployee();
- break;
- case 4:
- System.out.println();
- // Admin.editEmployee();
- break;
- case 5:
- System.out.println();
- break;
- default:
- System.exit(6);
- break;
- }
- }
- }else{
- System.out.println("");
- System.out.println("Authentication Failed");
- }
- }catch (Exception e){
- System.out.println("Try Again");
- }}
- case 2:
- while(true){
- try{
- System.out.print("Employee ID:");
- String staffId = sc.next();
- if(staffId.equalsIgnoreCase("admin")){
- System.out.println("Welcome user");
- } else{
- System.out.println("Username and Password not found. Try again");
- }
- } catch (Exception e){
- System.out.println("Try again");
- }
- }
- case 3:
- System.exit(3);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement