Question: Basic java please help  QUESTION 1: Add code to ask user about the number of players (from 1 to 3) – use game.askForInt. Store the input in a

Question: Basic java please help  QUESTION 1: Add code to ask user about the number of players (from 1 to 3) – use game.askForInt. Store the input in a variable numPlayers. QUESTION 2: Modify the code below to ask for players’ names and add them to the game in a for loop (up to numPlayers iterations). String name = game.askForText(“What is player 0

This problem has been solved!

Basic java please help 

QUESTION 1: Add code to ask user about the number of players (from 1 to 3) – use game.askForInt. Store the input in a variable numPlayers.

QUESTION 2: Modify the code below to ask for players’ names and add them to the game in a for loop (up to numPlayers iterations).

String name = game.askForText(“What is player 0 name?”);

game.addPlayer(name);

name = game.askForText(“What is player 1 name?”);

game.addPlayer(name);

name = game.askForText(“What is player 2 name?”);

game.addPlayer(name);

QUESTION 3: Modify this part to ask questions and get answers in a for loop (up to numPlayers iterations)  

game.setCurrentPlayer(0);

String answer = game.askForText(q0);

if(a0.equals(answer))

game.correct(); //display “Correct”, increment score, change frame color to green

else

game.incorrect(); //display “incorrect”, change frame color of player to red

game.setCurrentPlayer(1);

answer = game.askForText(q1);

if(a1.equals(answer))

game.correct();

else

game.incorrect();

game.setCurrentPlayer(2);

answer = game.askForText(q2);

if(a2.equals(answer))

game.correct();

else

game.incorrect();

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Careers in Linux System Administration (Required/Graded) SubscribeChoose from one of the following options. Be sure to include the option number in your

Careers in Linux System Administration (Required/Graded) SubscribeChoose from one of the following options. Be sure to include the option number in your response. 1. Job Search Use Indeed.com, Monster.com, or LinkedIn.com to research IT job careers that require Linux Administration skills in your area. You can use keywords such as "Linux

The following program draws an BB-8 as shown below.  Modify the program to move the BB-8 left or right using the arrow keys.  The program can be download

The following program draws an BB-8 as shown below.  Modify the program to move the BB-8 left or right using the arrow keys.  The program can be download from the CMS. Please use Javafx  import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Line; import javafx.stage.Stage;