Advertisement
Guest User

Untitled

a guest
Aug 4th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.06 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args){
  6.  
  7.         System.out.println("Welcome to our account setup system, \nPlease enter your username below." );
  8.  
  9.         Scanner scanner = new Scanner(System.in);
  10.  
  11.         String username = scanner.nextLine();
  12.  
  13.         System.out.println("Thank you, now enter your password.");
  14.  
  15.         String password = scanner.nextLine();
  16.  
  17.         Player playerCreator = new Player();
  18.  
  19.         playerCreator.getUsername(username);
  20.         playerCreator.getPassword(password);
  21.  
  22.         //test
  23.         playerCreator.newMethod();
  24.  
  25.         System.out.println("Your username is: " + username + ", and your password is: " + password + "\nWould you like to continue? Y/N");
  26.  
  27.         String response = scanner.nextLine();
  28.  
  29.         boolean tempRun = true;
  30.  
  31.         while(tempRun){
  32.  
  33.             if(response.equalsIgnoreCase("Y")){
  34.  
  35.                 System.out.println("You said yes.");
  36.  
  37.                 tempRun = false;
  38.  
  39.                 System.out.println("Please login below, enter your username");
  40.  
  41.                 String un = scanner.nextLine();
  42.  
  43.                 System.out.println("Please enter your password");
  44.  
  45.                 String pw = scanner.nextLine();
  46.  
  47.                 if(un.equals(username) && pw.equals(password)){
  48.                     System.out.println("thank you, " + username + " Please wait...");
  49.                     System.out.println("System booted.");
  50.                     Process process = new Process();
  51.                     process.isRunning();
  52.  
  53.  
  54.                 } else {
  55.                     System.out.println("Invalid username or password, exiting program.");
  56.                     scanner.close();
  57.                 }
  58.  
  59.  
  60.             } else if(response.equalsIgnoreCase("N")){
  61.  
  62.                 scanner.close();
  63.  
  64.                 System.out.println("Goodbye.");
  65.  
  66.                 tempRun = false;
  67.  
  68.             }else{
  69.  
  70.                 System.out.println("Invalid input, try again");
  71.  
  72.                 response = scanner.nextLine();
  73.  
  74.             }
  75.         }
  76.     }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement