Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1.  
  2. import java.util.Iterator;
  3. import java.util.*;
  4. import java.io.*;
  5.  
  6.  
  7.  
  8. public class payrollMain {
  9.  
  10. public ArrayList<DataEmployee> DateEmployeeArray = new ArrayList<DataEmployee>();
  11.  
  12. public static void main(String[] args) {
  13. Scanner sc = new Scanner(System.in);
  14.  
  15. System.out.println("[1]Admin\n[2]Staff\n[3]Log out");
  16. System.out.print("Enter choice:");
  17. int choice = sc.nextInt();
  18.  
  19. switch(choice){
  20. case 1:
  21. while(true){
  22. try{
  23. System.out.print("Username:");
  24. String name = sc.next();
  25. System.out.print("Password:");
  26. String pass = sc.next();
  27.  
  28. if(name.equalsIgnoreCase("admin") && pass.equalsIgnoreCase("admin")){
  29. System.out.print("Authentication Successful");
  30.  
  31. while(true){
  32. System.out.println(" OLS COMPANY ");
  33. System.out.println(" RECORD ");
  34. System.out.println("\n[1]DTR\n[2]Payroll");
  35. System.out.println("\n[3]Add\n[4]Search\n[5]Edit\n[6]Delete\n[7]Logout");
  36. System.out.println("");
  37. System.out.print("Enter choice:");
  38. choice = sc.nextInt();
  39.  
  40. switch(choice){
  41. case 1:
  42. System.out.println("DTR");
  43. break;
  44. case 2:
  45. System.out.println();
  46. System.out.println("PAYROLL");
  47. break;
  48. case 3: //add
  49. Admin.addEmployee();
  50. break;
  51. case 4:
  52. System.out.println();
  53. // Admin.editEmployee();
  54. break;
  55. case 5:
  56. System.out.println();
  57. break;
  58. default:
  59. System.exit(6);
  60. break;
  61. }
  62. }
  63. }else{
  64. System.out.println("");
  65. System.out.println("Authentication Failed");
  66. }
  67. }catch (Exception e){
  68. System.out.println("Try Again");
  69. }}
  70.  
  71. case 2:
  72. while(true){
  73. try{
  74. System.out.print("Employee ID:");
  75. String staffId = sc.next();
  76. if(staffId.equalsIgnoreCase("admin")){
  77. System.out.println("Welcome user");
  78. } else{
  79. System.out.println("Username and Password not found. Try again");
  80. }
  81. } catch (Exception e){
  82. System.out.println("Try again");
  83. }
  84. }
  85. case 3:
  86. System.exit(3);
  87.  
  88. }
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement