Advertisement
Guest User

main

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