Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions