Mrcastaway1729 Mrcastaway1729
  • 22-10-2020
  • Computers and Technology
contestada

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: 1A 1B 1C 1D 3A 3B 3C 3D 5A 5B 5C 5D java

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 22-10-2020

Answer:

public class MyClass {

public static void main(String args[]) {

for(int i =1; i<=5;i+=2){

for(char j ='A'; j<='D';j++){

System.out.print(i);

System.out.print(j+" ");

}

}

}

}

Explanation:

This line iterates through 1 to 5 wit an increment of 2

for(int i =1; i<=5;i+=2){

This line iterates through alphabets A to E

for(char j ='A'; j<='D';j++){

This line prints the seat numbers (1, 3 and 5)

System.out.print(i);

This line prints the seat letters(A-E)

System.out.print(j+" ");

}

}

Answer Link

Otras preguntas

which of the following represents the most accurate estimation of 38+23
whats the most accurate estimation of 65+77
why did people immigrate to the United States in the late 1800s?
please explain how to solve this  On Monday,it took Helen 3 hours to do  a page of science homework exercises.The next day she did the same number of exercises
why did people immigrate to the United States in the late 1800s?
''Life in a city is more rewarding than life outside a city."List two or three arguments in favor of this opinion and two or three arguments opposing this opini
A pencil measures 14 cm long. How many millimeters long is it?
please explain how to solve this  On Monday,it took Helen 3 hours to do  a page of science homework exercises.The next day she did the same number of exercises
why did people immigrate to the United States in the late 1800s?
whats the most accurate estimation of 65+77