Question: java question. how do I display the row and the column of any game the user asks for. example: Q: what game would you like

java question. how do I display the row and the column of any game the user asks for.

example:

Q: what game would you like to pick from 1 -82?

user input: 82.

Answer

Game: 82

Q1: 22 Q2: 12 Q3: 5 Q4: 5

this is the code below.

public static void main(String[] args)

{

// This 2 dimensional array holds scores for 82 games by quarter

int[][] teamScores = new int[82][4];

// Initialize the array to random scores

for (int game = 0; game < 82; game++) {

for (int qtr = 0; qtr < 4; qtr++) {

// We will assign a random number between 5 and 30 for each quarter)

teamScores[game][qtr] = (int)(Math.random()*25) + 5;

}

}

// View the scores for all games/quarters

for (int game = 0; game < 82; game++) {

System.out.println(" Game: " + (game+1));

for (int qtr = 0; qtr < 4; qtr++) {

System.out.print("Q" + (qtr+1) + ": " + teamScores[game][qtr] + "\t");

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!