Question

In Java; Given numRows and numColumns, print a list of all seats in a theater. Rows...

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 = currentColumnLetter
for(currentRow = 0; currentRow < numRows;currentRow++){
for(currentColumn = =

System.out.println("");
}
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
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();

        for (currentRow = 0; currentRow < numRows; currentRow++) {
            currentColumnLetter = 'A';
            for (currentColumn = 0; currentColumn < numColumns; currentColumn++) {
                System.out.print(currentRow + 1);
                System.out.print(currentColumnLetter + " ");
                currentColumnLetter++;
            }
        }
        System.out.println("");
    }
}

1A 1B 1C 2A 2B 2C

\color{blue}Hey,\;Please\;let\;me\;know\;if\;you\;need\;me\;to\;make\;any\;changes. \\ I\;would\;really\;appreciate\;an\;upvote.\;Thank\;you!

Add a comment
Know the answer?
Add Answer to:
In Java; Given numRows and numColumns, print a list of all seats in a theater. Rows...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (Java Zybooks) Given numRows and numColumns, print a list of all seats in a theater. Rows...

    (Java Zybooks) 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...

  • (Java Zybooks) 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 s...

    (Java Zybooks) 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...

  • Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered,...

    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. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C c++. #include <iostream> using namespace std; int main() { int numRows; int numColumns; int currentRow; int currentColumn; char currentColumnLetter; cin >> numRows; cin >> numColumns; cout << endl; return 0; }

  • C++ Given numRows and numColumns, print a list of all seats in a theater. Rows are...

    C++ 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. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C #include <iostream> using namespace std; int main() { int numRows; int numColumns; int currentRow; int currentColumn; char currentColumnLetter; cin >> numRows; cin >> numColumns; /* Your solution goes here */ cout...

  • C code Given numRows and numColumns, print a list of all seats in a theater. Rows...

    C code 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. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C #include <stdio.h> int main(void) { int numRows; int numColumns; int currentRow; int currentColumn; char currentColumnLetter; scanf("%d", &numRows); scanf("%d", &numColumns); /* Your solution goes here */ printf("\n"); return 0; }

  • Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number...

    Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces. For each printed line, print the leading spaces, then the number, and then a newline. Hint: Use i and j as loop variables (initialize i and j explicitly). Note: Avoid any other spaces like spaces after the printed number. Ex: userNum = 3 prints: 0 1 2 3 Sample program: #include <stdio.h> int main(void) { int userNum = 0; int i =...

  • Answer in JAVA 1. Complete the method definition to output the hours given minutes. Output for...

    Answer in JAVA 1. Complete the method definition to output the hours given minutes. Output for sample program: 3.5 import java.util.Scanner; public class HourToMinConv {    public static void outputMinutesAsHours(double origMinutes) {       /* Your solution goes here */    }    public static void main (String [] args) {       Scanner scnr = new Scanner(System.in);       double minutes;       minutes = scnr.nextDouble();       outputMinutesAsHours(minutes); // Will be run with 210.0, 3600.0, and 0.0.       System.out.println("");    } } 2....

  • Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a...

    Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp = {90, 92, 94, 95}, print: 90, 92, 94, 95 Your code's output should end with the last element, without a subsequent comma, space, or newline. import java.util.Scanner; public class PrintWithComma {    public static void main (String [] args) {       Scanner scnr = new Scanner(System.in);       final int NUM_VALS = 4;       int[] hourlyTemp = new...

  • In JAVA ACTIVITY 3.10.1: Rock-paper-scissors. Write a switch statement that checks nextChoice. If o print "Rock"....

    In JAVA ACTIVITY 3.10.1: Rock-paper-scissors. Write a switch statement that checks nextChoice. If o print "Rock". If 1 print "Paper". If 2 print "Scissors'. For any other value, print "Unknown'. End with newline. 2. 4 1 import java.util.Scanner; 3 public class Roshambo public static void main(String [] args) { 5 Scanner scnr - new Scanner(System.in); 6 int nextChoice; 7 8 nextChoice - scnr.nextInt(); 9 10 /" Your solution goes here */ 11 12 13} CHALLENGE ACTIVITY 3.10.2: Switch statement to...

  • CHALLENGE ACTIVITY 3.11.1: Using boolean. D Assign is Teenager with true if kidAge is 13 to...

    CHALLENGE ACTIVITY 3.11.1: Using boolean. D Assign is Teenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign is Teenager with false. 1 import java.util.Scanner; 3 public class TeenagerDetector 1 public static void main (String [] args) { Scanner scnr = new Scanner(System.in); boolean isTeenager; int kidAge; D}]oll kidage = scnr.nextInt(); /* Your solution goes here */ Go USB if (isTeenager) { System.out.println("Teen"); else { System.out.println("Not teen"); 20 Run Feedback? CHALLENGE ACTIVITY 3.11.2: Boolean in branching statements. Write...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT