Commit 4dc18bf8 authored by Jordan's avatar Jordan

array time

parent c68cdefd
...@@ -4,7 +4,6 @@ import java.util.Random; ...@@ -4,7 +4,6 @@ import java.util.Random;
public class AirlineReservation { public class AirlineReservation {
public static void main(String[] args) { public static void main(String[] args) {
// TODO Auto-generated method stub
// Write an application to assign seats on each flight of the airplane. // Write an application to assign seats on each flight of the airplane.
// Each flight has 90 seats. // Each flight has 90 seats.
...@@ -80,6 +79,29 @@ public class AirlineReservation { ...@@ -80,6 +79,29 @@ public class AirlineReservation {
} }
int[][] seats = new int[9][10];
int seatno=0;
for(int i=0; i<9; i++)
for(int j=0; j<10; j++) {
seats[i][j]=seatno;
seatno++;
if (seatno<=9) {
System.out.print("[" + 0 + seatno + "]" + " " + "" +" ");
}
else if (seatno<=18) {
System.out.print("[" + seatno + "]" + " ");
}
}
// Display a seating chart using an array, using a 9x10 chart. // Display a seating chart using an array, using a 9x10 chart.
// After a seat is assigned, replace the seat number with XX in the array. // After a seat is assigned, replace the seat number with XX in the array.
...@@ -110,5 +132,6 @@ public class AirlineReservation { ...@@ -110,5 +132,6 @@ public class AirlineReservation {
} }
} }
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