Answer to Question #208311 in Java | JSP | JSF for Ronnie

Question #208311

Question 1) Declare and initialize a one dimensional array to hold the numeric index values for each character in your own simulated game theme.

Question 2) Declare and initialize a two dimensional array to hold the textual character attribute data for all characters. Include data for at least two textual attributes per character


1
Expert's answer
2021-06-18T02:54:56-0400
public class main {

	public static void main(String[] args) {
		// Declare 1D array to hold numeric index values
		int indices [];
		// Initialise array
		indices = new int[2];
		
		// Assign values to each item in array
		for (int index = 0; index < indices.length; index++) {
			indices[index] = index;
		}
		
		// Declare 2D array to hold textual character attribute data
		String textAttributes [][];
		// Initialise array
		textAttributes = new String[2][2];
		
		// Assign values to each item in array
		textAttributes[0][0] = "Player 1";
		textAttributes[0][1] = "Some text attribute";
		textAttributes[1][0] = "Player 2";
		textAttributes[1][1] = "Some other text attribute";


	}


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS