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

Hello Students, As discussed in class, the Workspaces and Challenges are now active. Required Challenges for Full Credit To earn full credit (30% of the

Hello Students, As discussed in class, the Workspaces and Challenges are now active. Required Challenges for Full Credit To earn full credit (30% of the assignment), you must complete 8 challenges from the following list: Interns & HR on the Domain Controller Help Desk Fun: User Workstation Nightmares Dangerous Drives Preventative Protection: Thwarting the Imminent Threat Security

Please read the instructions below carefully. Required Challenges for Full Credit Vulnerability Scan Complete, Begin System Hardening [NG] Volatile

Please read the instructions below carefully. Required Challenges for Full Credit Vulnerability Scan Complete, Begin System Hardening [NG] Volatile Vulnerabilities [NG] The Network is Down! Internal Issues Edition [NG] The Network is Down! Contractor Edition [NG] (Complexity 1) The Network is Down! Contractor Edition [NG] Systems Security Analyst Crash Course

Hello Students, Please pay attention to the instructions below. Required Challenges for Full Credit To earn full credit (30% of the assignment), you must

Hello Students, Please pay attention to the instructions below. Required Challenges for Full Credit To earn full credit (30% of the assignment), you must complete 6 challenges from the following list: Interns & HR on the Domain Controller Help Desk Fun: User Workstation Nightmares Dangerous Drives Preventative Protection: Thwarting the Imminent Threat Security