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

Tunneling in VPN refers to securely transmitting data across the internet by encapsulating it within another packet, resulting in a “tunnel.” This process

Tunneling in VPN refers to securely transmitting data across the internet by encapsulating it within another packet, resulting in a “tunnel.” This process ensures privacy and security by preventing unauthorized access to data during transmission. Common tunneling protocols include PPTP, L2TP, and OpenVPN, which help to ensure data confidentiality and

How does Rupa Huq’s argument in “Rethinking Subculture” relate to Dick Hebdige’s understanding of subculture, as explained by Huq? Explain how Hebdige or

How does Rupa Huq’s argument in “Rethinking Subculture” relate to Dick Hebdige’s understanding of subculture, as explained by Huq? Explain how Hebdige or Huq’s understanding of style relates to how youth express identity and community today. Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table

Week8_Test Plan Instructions: The Test Plan for each project includes the Pseudocode, Flowchart, Goals and Objectives, Functional Requirements, and Test

Week8_Test Plan Instructions: The Test Plan for each project includes the Pseudocode, Flowchart, Goals and Objectives, Functional Requirements, and Test Matrix including Actual Output column.  Below the table are screenshots verifying the actual output for each case. Note:  Your programming projects should be submitted in the Revel environment for grading. Week