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

Accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter

Accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter with 7 years of research based experience. My passion for research, writing, and editin g makes me the perfect professional for varying topics in Studydaddy. I understand the value of detailed research

BYOD Registration Form Resources To complete this project, you may need to review instructions on how to take a screenshot.   Locate System

BYOD Registration Form Resources To complete this project, you may need to review instructions on how to take a screenshot.   Locate System Information Review this resource to check how to locate your system information.   Template Use the BYOD Ingest Form Template to complete the project. Delete the instructional text from the template before you submit.    2024 University of

Topic: Computer ScienceDistributed Database Management Systems (DDBMS), is the next generation of Database Management Systems, where the data is stored at

Topic: Computer ScienceDistributed Database Management Systems (DDBMS), is the next generation of Database Management Systems, where the data is stored at several geographical locations, but from the user or application perspective, it is still one Database. These are the advantages of this paradigm: enlarged availability and reliability of data, and

In this part, you are asked to explore and/or investigate distributed database management system (DDBMS). You can either explore the main concepts or

In this part, you are asked to explore and/or investigate distributed database management system (DDBMS). You can either explore the main concepts or technical challenges of DDBMS in general (without directly specifying a certain DBMS) or you can research a specific DBMS and present how it manages different aspects of distribution. Your exploration or

**Tutorial: Introduction to Graph Theory** **Category:** Computer Science **Details:** Graph theory is a foundational concept in computer science and

**Tutorial: Introduction to Graph Theory** **Category:** Computer Science **Details:** Graph theory is a foundational concept in computer science and mathematics, focusing on the study of graphs, which are structures consisting of nodes (vertices) and edges (connections between nodes). This tutorial provides a comprehensive introduction to graph theory, covering essential topics