Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Database {
  4. String[] userid = new String[2];
  5. {
  6. userid[0] = "admin";
  7. }
  8.  
  9. Scanner input = new Scanner(System.in);
  10. int arrayindex = 1;
  11. String username;
  12.  
  13. void Database(String invoke) {
  14. while (arrayindex < userid.length) {
  15.  
  16. System.out.println("Register username");
  17. username = input.nextLine();
  18. userid[arrayindex] = username;
  19.  
  20. arrayindex++;
  21.  
  22. }
  23. }
  24.  
  25. }
  26.  
  27. public class App {
  28.  
  29. public static void main(String[] args) {
  30.  
  31. Database Machine = new Database();
  32. Scanner input = new Scanner(System.in);
  33. String login;
  34. int indexcount = 1;
  35.  
  36. Machine.Database("invoke");
  37.  
  38. System.out.println("enter login info");
  39.  
  40. while (indexcount < Machine.userid.length) {
  41. login = input.nextLine();
  42. if (login.equals(Machine.userid[indexcount])) {
  43. System.out.println("logged in");
  44. indexcount++;
  45. } else {
  46. System.out.println("wrong account");
  47. }
  48.  
  49. }
  50.  
  51. }
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement