Commit c47eaca2 authored by User's avatar User

display seats

parent 80b618ec
package airlinereservation;
import java.util.Scanner;
import java.util.Scanner; //import scanner module
public class reservation {
public static void main(String[] args) {
public static void main(String[] args) {//main subprogram
Scanner input = new Scanner(System.in);
String board[][] = {{"01", "02", "03"}, {"04", "05", "06"}, {"07", "08", "09"},
String plane[][] = {{"01", "02", "03"}, {"04", "05", "06"}, {"07", "08", "09"}, //initialise the array which contains the plane seats
{"10", "11", "12"}, {"13", "14", "15"}, {"16", "17", "18"},
{"19", "20", "21"}, {"22", "23", "24"}, {"25", "26", "27"},
{"28", "29", "30"}, {"31", "32", "33"}, {"34", "35", "36"},
{"37", "38", "39"}, {"40", "41", "42"}, {"43", "44", "45"},
{"46", "47", "48"}, {"49", "50", "51"}, {"52", "53", "54"},
{"46", "47", "48"}, {"49", "50", "51"}, {"52", "53", "54"}, //listing of all seat numbers
{"55", "56", "57"}, {"58", "59", "60"}, {"61", "62", "63"},
{"64", "65", "66"}, {"67", "68", "69"}, {"70", "71", "72"},
{"73", "74", "75"}, {"76", "77", "78"}, {"79", "80", "81"},
{"82", "83", "84"}, {"85", "86", "87"}, {"88", "89", "90"}};
display(plane);
}
public static void display(String plane[][]) {
int x =0;
for(int i=0; i<3; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
System.out.println();
for(int i=3; i<6; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
System.out.println();
System.out.println();
for(int i=6; i<9; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
System.out.println();
for(int i=9; i<12; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
System.out.println();
for(int i=12; i<15; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
System.out.println();
System.out.println();
for(int i=15; i<18; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
System.out.println();
for(int i=18; i<21; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
System.out.println();
for(int i=21; i<24; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
System.out.println();
for(int i=24; i<27; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
System.out.println();
for(int i=27; i<30; i++) {
for(int j=0; j<3; j++) {
System.out.print("[" + plane[i][j] + "]");
}
System.out.print("\t");
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment