Guest User

Untitled

a guest
Nov 27th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.59 KB | None | 0 0
  1. static Scanner input= new Scanner(System.in);
  2.  
  3. public static void main(String[] args) {
  4.  
  5. System.out.println(" tt@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@n"
  6. + " tt@ @n"
  7. + " tt@ ★ Saladaty Restaurant ★ @n"
  8. + " tt@ @n"
  9. + " tt@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@n");
  10.  
  11. ArrayList <User> systemUsers=new ArrayList<>();
  12.  
  13. //Admins of the system List:
  14. systemUsers.add(new Admin("@Zahraa_Maher","Z#M1996AN","Zahraa Maher Al-Nemer"));
  15. systemUsers.add(new Admin("@Malak_Mohammad","memeD1998","Malak Mohammad Darweesh"));
  16. systemUsers.add(new Admin("@Lamyaa_Mohammad","lammoy998","Malak Mohammad Darweesh"));
  17. systemUsers.add(new Admin("@Zainab_Abduljalil","ZaiJalil9","Zainab Abduljalil Alrashed"));
  18. systemUsers.add(new Admin("@Rasha_Mubarak","RereMD123","Rasha Mubarak Al-Dawssary"));
  19. systemUsers.add(new Admin("@Salhah_Yasin","SalYas321","Salhah Yaseen Al-far"));
  20.  
  21.  
  22.  
  23. System.out.println(" WELCOME TO SALADATY APPLICATION ");
  24. System.out.println("------------------------------------------");
  25.  
  26. int choice=0;
  27.  
  28. while (choice!=4){
  29.  
  30. System.out.print(" nchose:"
  31. + "n 1- I have membership ( Sign in )"
  32. + "n 2- I don't have mempership ( Register )"
  33. + "n 3- Back to the Home Page"
  34. + "nyour choice>> ");
  35. choice=input.nextInt();
  36. input.nextLine();
  37.  
  38. switch(choice){
  39.  
  40. case 1:
  41. System.out.print("Enter your username: ");
  42. String username=input.nextLine();
  43. System.out.print("Enter your password: ");
  44. String pass=input.nextLine();
  45.  
  46. for (int i = 0; i <systemUsers.size(); i++) {
  47.  
  48. if ((systemUsers.get(i).getUserName().equals(username))&& (systemUsers.get(i).getPassword().equals(pass))){
  49. if (systemUsers.get(i) instanceof Admin){
  50.  
  51. System.out.println("n===========( Welcome Admin )=========== n");
  52.  
  53. // logic of what admin can do
  54. //( Admin Menu using while + switch + methods )
  55.  
  56. }
  57.  
  58.  
  59. else if (systemUsers.get(i) instanceof Customer){
  60.  
  61. System.out.println("n===========( Welcome Customer )=========== n");
  62.  
  63. //logic of what customer can do if he/she has membership
  64. //( Customer Menu using while + switch + methods )
  65.  
  66. }
  67.  
  68. }
  69. }
  70.  
  71.  
  72.  
  73. break;
  74.  
  75. case 2:
  76.  
  77. //invoking the Regesteration method to make customer membership:
  78. CustomerRegister(systemUsers);
  79.  
  80. break;
  81.  
  82.  
  83. case 3:
  84. System.out.println("n===========( Back to the Home Page! )=========== n");
  85. break;
  86.  
  87.  
  88. default:
  89. System.out.println("Invalid choice");
  90.  
  91.  
  92. }
  93.  
  94. }
  95.  
  96. } // end of main method
  97.  
  98.  
  99.  
  100. // methods to invoke inside main:
  101.  
  102. //1. CustomerRegister method:
  103. public static void CustomerRegister(ArrayList <User> myUsers){
  104.  
  105. int index=6;
  106.  
  107. System.out.println("n===========( Customer Membership Registeration )=========== n");
  108. System.out.println(" [ Entering user information ]");
  109. System.out.print(" Enter username: ");
  110. String username=input.next();
  111. System.out.print(" Enter your password: ");
  112. String password=input.next();
  113. System.out.print(" Enter your e-mail: ");
  114. String email=input.next();
  115. System.out.print(" Enter your phoneNum: ");
  116. String phoneNum=input.next();
  117. input.nextLine();
  118. System.out.print("n [ Enter your information ]n");
  119. System.out.print(" what is your name ? ");
  120. String namecustomer=input.nextLine();
  121. System.out.print(" what is your address ? ");
  122. String address=input.nextLine();
  123. System.out.print(" what is your credit card number ?");
  124. String creditNo=input.nextLine();
  125.  
  126.  
  127.  
  128. myUsers.add(new Customer(namecustomer, address, creditNo,username, password, phoneNum,true, email));
  129.  
  130. if (myUsers.get(index) instanceof Customer){
  131.  
  132. Customer c= (Customer)myUsers.get(index);
  133.  
  134. System.out.println("n** Thank you for registerin dear "+c.getName()+", your username is: "+c.getUserName()+" **");
  135. index++;
  136.  
  137. }
  138. }
  139.  
  140.  
  141. }
Add Comment
Please, Sign In to add comment