Question

Print a list of seats in a theater. Rows are numbered, columns lettered, as in 1A...

Print a list of seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat. Create a nested loop to print the following (IN JAVA):

1A 1B 1C 1D
3A 3B 3C 3D
5A 5B 5C 5D

Homework Answers

Answer #1
import java.util.Scanner;

public class TheatreSeats {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter number of rows: ");
        int rows = in.nextInt();
        System.out.print("Enter number of columns: ");
        int columns = in.nextInt();

        for (int i = 0; i < rows; i++) {
            char seat = 'A';
            for (int j = 0; j < columns; j++) {
                System.out.print((2*i+1) + "" + seat + " ");
                seat++;
            }
            System.out.println();
        }
    }
}

Know the answer?
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
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT