import java.util.Scanner; import java.util.ArrayList; public class SMS { public static void main (String[] args) { ArrayList<Member> someStuff = new ArrayList<Member>(); Scanner scan = new Scanner(System.in); int option = 0; boolean check = true; while(check){ System.out.println("Welcome to the SMSer 4000!"); System.out.println("Please choose what you would like to do"); System.out.println("1. Log into my account"); System.out.println("2. Create a new account"); System.out.println("3. Exit"); option = scan.nextInt(); switch(option) { case 1: option = 1; String password; int mobile_number; System.out.println("Account Login is opening"); System.out.println("--"); System.out.println("Account Login has opened"); System.out.println("--"); System.out.print("\n Please enter your phone number: "); mobile_number = scan.nextInt(); System.out.print(" Please enter your password: "); password = scan.next(); break; case 2: option = 2; System.out.println("Account Creation is opening"); System.out.println("--"); System.out.println("Account Creation has opened"); System.out.println("--"); char quit = 'Y'; while (quit == 'Y') { System.out.print("\n Number: "); mobile_number = scan.nextInt(); System.out.print(" Password: "); password = scan.next(); someStuff.add (new Member(mobile_number, password)); System.out.print(" Would you like to register another account? (Y/N)"); String word = scan.next(); word = word.toUpperCase(); quit= word.charAt(0); } for(Member stuff : someStuff) System.out.println(stuff); break; case 3: option = 3; check = false; System.out.println("SMSer 4000 is now closing."); break; } } } }
How can I create a login feature that checks through the array to see if it exists?