1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
docker41 [41]
2 years ago
10

In Java; Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or

3E. Print a space after each seat, including after the last. Use separate print statements to print the row and column. Ex: numRows = 2 and numColumns = 3 prints:1A 1B 1C 2A 2B 2C import java.util.Scanner;public class NestedLoops {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);int numRows;int numColumns;int currentRow;int currentColumn;char currentColumnLetter;numRows = scnr.nextInt();numColumns = scnr.nextInt();numColumns = currentColumnLetterfor(currentRow = 0; currentRow < numRows;currentRow++){for(currentColumn = =System.out.println("");}}
Computers and Technology
1 answer:
gtnhenbr [62]2 years ago
4 0

Answer:

The solution code is written in Java.

  1. import java.util.Scanner;
  2. public class Main {
  3.    public static void main(String[] args) {
  4.        String letters[] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"};
  5.        Scanner scnr = new Scanner(System.in);
  6.        int numRows;
  7.        int numColumns;
  8.        int currentRow;
  9.        int currentColumn;
  10.        numRows = scnr.nextInt();
  11.        numColumns = scnr.nextInt();
  12.        for(currentRow = 0; currentRow < numRows;currentRow++){
  13.            for(currentColumn =0; currentColumn < numColumns; currentColumn++)
  14.            {
  15.                System.out.print((currentRow + 1) + letters[currentColumn] + " ");
  16.            }
  17.        }
  18.    }
  19. }

Explanation:

Firstly, we need to create an array to hold a list of letters (Line 6). In this solution, only letters A - J are given for simplicity.

Next, we declare all the variables that we need, numRows, numColumns, currentRow and currentColumn (Line 8 - 11).

Next, we use Scanner object, scnr to prompt user to input integer for <em>numRows </em>and <em>numColumns </em>(Line 12-13).

At last, we use two-layer for loops to traverse through the number of rows and columns and print out the currentRow and currentColumn (Line 15-19). Please note the currentRow is added by 1 as the currentRow started with 0. To print the letter, we use currentColumn as an index to take out the letter from the array.

You might be interested in
10.Find the first ICMP Echo Request message that was sent by your computer after you changed the Packet Size in pingplotter to b
Shalnov [3]

Answer:

The message was fragmented across more than one IP datagram

Explanation:

ICMP Echo Request query message is a request sent by a user to a destination system, which then sends an ICMP Echo Reply query message`as a reply.

After I changed the Packet Size in pingplotter to be 2000, the first ICMP Echo Request message that was sent by the computer was:

Flags: 0×01 more fragments.

The message was fragmented across more than one IP datagram

6 0
2 years ago
Does the brain play a role in smartphone addiction
Fynjy0 [20]
Attractive Google search and browse website . playing video games smartphone addiction
7 0
3 years ago
Read 2 more answers
Technician A says that if you add pre-lube to a sealing lip of an axle seal, it will cause the seal to leak causing the bearings
Verizon [17]
Technician B because you put grease on the sealing lip
7 0
3 years ago
Creative Commons Question -- At home, you created a really great digital song, audio jingle, or music track using some software
galina1969 [7]
C. It's honestly up to the user, upload so others can use it or make it so its copyrighted and make some cash :P
6 0
3 years ago
Which of the following is used by credit card companies to determine APR?
kodGreya [7K]
Prime rate + credit history (APEX)
4 0
3 years ago
Read 2 more answers
Other questions:
  • Monica needs a printer to use at home. She wants fine-quality prints at an affordable cost. Which printer will help her achieve
    9·1 answer
  • PLEASE HELP Which of the following is considered a modern method of communication?
    6·2 answers
  • What is the command to use the memory diagnostics tool?
    11·1 answer
  • What is a series of instructions or commands that a computer follows used to create software
    9·1 answer
  • A girl scout troop with 10 girl scouts and 2 leaders goes on a hike. When the path narrows, they must walk in single file with a
    12·1 answer
  • How we can get NET I'D by IP Address?
    11·1 answer
  • Assume the existence of an UNSORTED ARRAY of n characters. You are to trace the CS111Sort algorithm (as described here) to reord
    14·1 answer
  • Plz hurry it’s timed
    5·1 answer
  • Davingould1115...................answer 2​
    11·2 answers
  • Look at (c), is it accurate? ​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!