Use an array to represent the seating chart of the plane. Initialize all the elements of the array to 0 to indicate that all seats are empty. As each seat is assigned, set the corresponding elements of the array to 1 to indicate that the seat is no longer available.
import java.util.Array s;
import java.util.Rando m;
import java.lang.refle ct.Array;
public class AirlineBooking1
{
// public AirlineBooking(
//)
final int SEATCAPACITY = 10;
int smoke=1;
int nonsmoke=2;
int [] seatonezero;
int m;
AirlineBooking1 user = new AirlineBooking1 ();
seat = new int[SEATCAPACITY];
String[] seatonezero= { "0","0","0","0" ,"0","0","0","0 ","0","0" };
System.out.prin tln("Seats options: 1)SMOKE 2)NON-SMOKE. Enter your choice: ");
m = Keyboard.readIn t();
System.out.prin tln m;
for (int i = 0; i < 5; i++){
seat[i] = 0;
}
import java.util.Array s;
import java.util.Rando m;
import java.lang.refle ct.Array;
public class AirlineBooking1
{
// public AirlineBooking(
//)
final int SEATCAPACITY = 10;
int smoke=1;
int nonsmoke=2;
int [] seatonezero;
int m;
AirlineBooking1 user = new AirlineBooking1 ();
seat = new int[SEATCAPACITY];
String[] seatonezero= { "0","0","0","0" ,"0","0","0","0 ","0","0" };
System.out.prin tln("Seats options: 1)SMOKE 2)NON-SMOKE. Enter your choice: ");
m = Keyboard.readIn t();
System.out.prin tln m;
for (int i = 0; i < 5; i++){
seat[i] = 0;
}
Comment