Create a Thanksgiving themed game in Java.
This was given to us extra as I like to get extra credit but I need a little help with it.
All you need to do is make any type of little game like rock paper scissors or something of your preference...whatever is easier for you.

Respuesta :

import java.util.Scanner;

import java.util.Random;

public class JavaApplication73 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Welcome to Rock, Paper, Scissors.");

       String []computerChoices = {"rock", "paper", "scissors"};

       int userScore = 0, computerScore = 0, count = 0;

       while (true){

           String choice = computerChoices[(int)(Math.random()*3)];

           System.out.print("Pick rock, paper, or scissors: ");

           String userChoice = scan.nextLine();

           if (userChoice == choice){

               System.out.println("It's a draw!");

               count += 1;

           }

           else if (userChoice.equals("rock") && choice.equals("scissors")){

               System.out.println("You won! Rock crushes scissors.");

               userScore += 1;

           }

           else if (userChoice.equals("paper")&& choice.equals("rock")){

               System.out.println("You won! Paper covers rock.");

               userScore += 1;

           }

           else if (userChoice.equals("scissors") && choice.equals("paper")){

               System.out.println("You won! Scissors cut paper.");

               userScore += 1;

           }

           else{

               System.out.println("You lost! Bett luck next time!");

               computerScore += 1;

           }

           System.out.print("Do you want to play again? (y/n) ");

           String answer = scan.nextLine();

           if (answer.equals("n")){

               break;

           }

           

       

   }

       System.out.println("You won "+userScore+" game(s).");

       System.out.println("The computer won "+computerScore+" game(s).");

       System.out.println("You played a total of "+(count + computerScore + userScore)+" game(s)");

       

   }

   

}

I hope this helps!

ACCESS MORE