Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Triacontakai
- * Fun Overcomplicated Login System
- */
- import java.util.Scanner;
- public class KotliarovA_Woots {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- String[] user = {"HexBeetle75", "SparklePony10", "PetPet"};
- String[] pass = {"invasivespecies", "glitterific!", "particardi"}; //could use 1 array but thats ugly
- System.out.print("Username: ");
- String userin = input.nextLine();
- System.out.print("Password: ");
- String passin = input.nextLine();
- boolean userval = false;
- boolean passval = false;
- for(int i = 0; i < 3; i++) { //oh boy here's the fun part
- if(userin.equals(user[i])) { //this probably could have been simpler
- userval = true; //but it works!
- if(passin.equals(pass[i]))
- passval = true;
- }
- }
- if(!userval) {
- System.out.println("No account with the username \""+ userin +"\".");
- }
- else if(!passval) {
- System.out.println("Password incorrect!");
- }
- else {
- System.out.println("Welcome, "+ userin +"!");
- }
- input.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement