Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class games_project {
- public static void main(String[] args) {
- Scanner userinput = new Scanner(System.in);
- String full_name = "James Burton";
- String full_name2 = "Brian Ross";
- String full_name3 = "Bill Gates";
- String password = "thomas";
- System.out.println("Please sign in.");
- System.out.println("Full name, please: ");
- boolean game = true;
- while (game) {
- String username;
- username = userinput.nextLine();
- if (username.equalsIgnoreCase(full_name) || username.equalsIgnoreCase(full_name2) || username.equalsIgnoreCase(full_name3)) {
- System.out.println("Hello, " + username + ".");
- break;
- } else {
- System.out.println("Sorry that was incorrect try again.");
- }
- }
- System.out.println("Please enter your password: ");
- boolean pass = true;
- while (pass) {
- String check;
- check = userinput.next();
- if (check.equals(password)) {
- System.out.println("Welcome.");
- break;
- } else {
- System.out.println("Sorry that was incorrect. Try again.");
- }
- }
- System.out.println("Let's get started, shall we? What game would you like to play?");
- System.out.println("1) Checkers");
- System.out.println("2) Connect Four");
- System.out.println("3) Minesweeper");
- boolean games = true;
- while (games) {
- String game_choice;
- game_choice = userinput.next();
- if (game_choice.equalsIgnoreCase("Checkers") || game_choice.equals("1")) {
- System.out.println("Ok. Enjoy checkers.");
- break;
- } else if (game_choice.equalsIgnoreCase("connect four") || game_choice.equals("2")) {
- System.out.println("Ok. Enjoy connect four.");
- break;
- } else if (game_choice.equalsIgnoreCase("minesweeper") || game_choice.equals("3")) {
- System.out.println("Ok. Enjoy minesweeper.");
- break;
- } else {
- System.out.println("Sorry, please type in either the game name or the number besides it. Thank you!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement