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
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(); } } }
Get Answers For Free
Most questions answered within 1 hours.