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

Rio grande river separates what Texas city from Mexico starts with E
Rio grande river separates what Texas city from Mexico starts with E
What is the difference between preterite and imperfect and the past progressive and present progressive?
Which statement illustrates the distributive property? Please help
What is the difference between preterite and imperfect and the past progressive and present progressive?
What is 36 percent as a decimal?
What is the difference between preterite and imperfect and the past progressive and present progressive?
Which statement illustrates the distributive property? Please help
What is the difference between preterite and imperfect and the past progressive and present progressive?
Which statement illustrates the distributive property? Please help