Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static Scanner input= new Scanner(System.in);
- public static void main(String[] args) {
- System.out.println(" tt@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@n"
- + " tt@ @n"
- + " tt@ ★ Saladaty Restaurant ★ @n"
- + " tt@ @n"
- + " tt@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@n");
- ArrayList <User> systemUsers=new ArrayList<>();
- //Admins of the system List:
- systemUsers.add(new Admin("@Zahraa_Maher","Z#M1996AN","Zahraa Maher Al-Nemer"));
- systemUsers.add(new Admin("@Malak_Mohammad","memeD1998","Malak Mohammad Darweesh"));
- systemUsers.add(new Admin("@Lamyaa_Mohammad","lammoy998","Malak Mohammad Darweesh"));
- systemUsers.add(new Admin("@Zainab_Abduljalil","ZaiJalil9","Zainab Abduljalil Alrashed"));
- systemUsers.add(new Admin("@Rasha_Mubarak","RereMD123","Rasha Mubarak Al-Dawssary"));
- systemUsers.add(new Admin("@Salhah_Yasin","SalYas321","Salhah Yaseen Al-far"));
- System.out.println(" WELCOME TO SALADATY APPLICATION ");
- System.out.println("------------------------------------------");
- int choice=0;
- while (choice!=4){
- System.out.print(" nchose:"
- + "n 1- I have membership ( Sign in )"
- + "n 2- I don't have mempership ( Register )"
- + "n 3- Back to the Home Page"
- + "nyour choice>> ");
- choice=input.nextInt();
- input.nextLine();
- switch(choice){
- case 1:
- System.out.print("Enter your username: ");
- String username=input.nextLine();
- System.out.print("Enter your password: ");
- String pass=input.nextLine();
- for (int i = 0; i <systemUsers.size(); i++) {
- if ((systemUsers.get(i).getUserName().equals(username))&& (systemUsers.get(i).getPassword().equals(pass))){
- if (systemUsers.get(i) instanceof Admin){
- System.out.println("n===========( Welcome Admin )=========== n");
- // logic of what admin can do
- //( Admin Menu using while + switch + methods )
- }
- else if (systemUsers.get(i) instanceof Customer){
- System.out.println("n===========( Welcome Customer )=========== n");
- //logic of what customer can do if he/she has membership
- //( Customer Menu using while + switch + methods )
- }
- }
- }
- break;
- case 2:
- //invoking the Regesteration method to make customer membership:
- CustomerRegister(systemUsers);
- break;
- case 3:
- System.out.println("n===========( Back to the Home Page! )=========== n");
- break;
- default:
- System.out.println("Invalid choice");
- }
- }
- } // end of main method
- // methods to invoke inside main:
- //1. CustomerRegister method:
- public static void CustomerRegister(ArrayList <User> myUsers){
- int index=6;
- System.out.println("n===========( Customer Membership Registeration )=========== n");
- System.out.println(" [ Entering user information ]");
- System.out.print(" Enter username: ");
- String username=input.next();
- System.out.print(" Enter your password: ");
- String password=input.next();
- System.out.print(" Enter your e-mail: ");
- String email=input.next();
- System.out.print(" Enter your phoneNum: ");
- String phoneNum=input.next();
- input.nextLine();
- System.out.print("n [ Enter your information ]n");
- System.out.print(" what is your name ? ");
- String namecustomer=input.nextLine();
- System.out.print(" what is your address ? ");
- String address=input.nextLine();
- System.out.print(" what is your credit card number ?");
- String creditNo=input.nextLine();
- myUsers.add(new Customer(namecustomer, address, creditNo,username, password, phoneNum,true, email));
- if (myUsers.get(index) instanceof Customer){
- Customer c= (Customer)myUsers.get(index);
- System.out.println("n** Thank you for registerin dear "+c.getName()+", your username is: "+c.getUserName()+" **");
- index++;
- }
- }
- }
Add Comment
Please, Sign In to add comment