I want to build a Bus seat service. Like: Seat
1A 1B 1C 1D
2A 2B 2C 2D
3A 3B 3C 3D
3A 3B 3C 3D
4A 4B 4C 4D
5A 5B 5C 5D
6A 6B 6C 6D
7A 7B 7C 7D
Depending of number rows the user want to insert.
My code works well but I would like to improve it. Any suggestion will be so nice. Note: I hate the way I wrote nested for loop with no braces.
code:
static void busRow(int numberOfRows){
String letters[] = {"A","B","C","D"};
if (numberOfRows<=0){
System.out.println("Without Seats? It isn't a bus! please insert number of rows");
}
for (int i =1; i<=numberOfRows;i++){
for (int j =0;j<letters.length;j++)
System.out.print(i+""+letters[j]+" ");
System.out.println();
}
}