SenpaiZero

mainClass

Feb 29th, 2024
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class runGame {
  4.     public static void main(String[] args)
  5.     {
  6.         String userInput;
  7.         Scanner scanner = new Scanner(System.in);
  8.         runGame run = new runGame();
  9.        
  10.         do
  11.         {
  12.             System.out.println("WELCOME TO THE GAMING HUB!\n");
  13.             System.out.println("Choose a game: \n[1] Hangman \n[2]Rock Paper Scissor \n[3] Quit");
  14.             System.out.print("Enter: ");
  15.             userInput = scanner.nextLine();
  16.             System.out.println("\n\n================================\n\n");
  17.            
  18.             if(userInput.equals("1"))
  19.                 run.hangman();
  20.             else if(userInput.equals("2"))
  21.                 run.rockPaperScissor();
  22.             else if(userInput.equals("3"))
  23.                 break;
  24.         } while(true);
  25.        
  26.         System.out.println("\nThe system has stopped.");
  27.     }
  28.    
  29.     private void rockPaperScissor()
  30.     {
  31.         rock_paper_scissor rps = new rock_paper_scissor(3);
  32.         rps.start();
  33.     }
  34.    
  35.     private void hangman()
  36.     {
  37.         String[] randomWords = {"Apple", "Orange", "Banana", "Potato", "Strawberry"};
  38.         hangman hang = new hangman(3, randomWords);
  39.         hang.play();
  40.     }
  41. }
  42.  
Add Comment
Please, Sign In to add comment