Commit ead03680 authored by 9731050's avatar 9731050

4th

parent 66067b28
......@@ -2,6 +2,11 @@ package com.TicketManagement;
import java.util.ArrayList;
/**
* this class is airplane class and airplane are collaborated
* with seat and flight classes directly
* @author Mohammad Kazemi
*/
public class Airplane {
private String model;
private ArrayList<Seat>seats;
......@@ -12,23 +17,45 @@ public class Airplane {
freeSeats=new ArrayList<>();
}
/**
*
* @return the model of airplane
*/
public String getModel() {
return model;
}
/**
* this method adds seat to the airplane
* @param seat
*/
public void addSeat(Seat seat){
seats.add(seat);
freeSeats.add(seat);
}
/**
*
* @return airplane seats
*/
public ArrayList<Seat> getseats(){return seats;}
/**
* this method reserve a seat for passenger
* @param seat
* @param passenger
*/
public void reserveSeat(Seat seat,Passenger passenger){
if(seats.contains(seat)) {
freeSeats.remove(seat);
seat.setUser(passenger);
}
}
/**
*
* @return empty seats airplane
*/
public ArrayList<Seat>getFreeSeats(){return freeSeats;}
}
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