Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Input {
- Scanner input = new Scanner(System.in);
- public String Username;
- public String Password;
- public void createAcc() {
- System.out.println("Create a Username:");
- int x = 1;
- while(x == 1) {
- Username = input.nextLine();
- String initUser = Username;
- if(initUser.length() >= 5) { //checks if the user is greater than 5 chars for the lols
- x = 2;
- } else {
- System.out.println("ERROR: Your username must be above 5 characters!");
- }
- }
- System.out.println("Create a Password:");
- int y = 1;
- while(y == 1) {
- Password = input.nextLine();
- String initPass = Password;
- if(initPass.length() >= 5) { //checks if the password is greater than 5 chars for the lols
- y =2;
- } else {
- System.out.println("ERROR: Your password must be above 5 characters!");
- }
- }
- try {
- Thread.sleep(1000); //Completely worthless lines of code that literally slows down the process for 1 second for fun.
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- System.out.println("Account successfully created!");
- }
- public void userLogin() {
- int b = 1;
- int a = 1;
- System.out.println("==LOGIN==");
- System.out.println("Username:");
- while(a == 1) {
- String login = input.nextLine();
- if(login.equals(Username)) {
- a = 2;
- System.out.println("Password:");
- while(b == 1) {
- String pass = input.nextLine();
- if(pass.equals(Password)) {
- b = 2;
- System.out.println("Welcome, " + Username);
- } else {
- System.out.println("Password incorrect");
- }
- }
- } else {
- System.out.println("Login incorrect");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement