|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object airline.Reservation airline.ProvisionalReservation
public class ProvisionalReservation
This subclass of Reservation
is used to represent
a tentative reservation in its intermediate
stages while being constructed by a Customer
.
Constructor Summary | |
---|---|
ProvisionalReservation(Customer c)
Creates a new ProvisionalReservation for this customer. |
Method Summary | |
---|---|
boolean |
addFlight(Flight f)
Attempts to add a flight as the next leg of the reservation. |
boolean |
addTraveler(String name)
Attempts to add a new traveler to the reservation. |
boolean |
purchase()
Attempts to purchase tickets for this reservation. |
Methods inherited from class airline.Reservation |
---|
allocateTicketArray, cancel, getAllLegs, getAllTravelerNames, getBooker, getLeg, getLocator, getNumLegs, getNumTravelers, getTicket, getTravelerName, isPurchased, setTicket |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProvisionalReservation(Customer c)
ProvisionalReservation
for this customer.
The booking customer is automatically deemed the first traveler.
A six-letter record locator is randomly generated (it is presumed,
but not guaranteed, to be unique).
c
- The booking Customer
Method Detail |
---|
public boolean addFlight(Flight f) throws IllegalStateException
Reservation
true
if successful; false
if this flight was already on the reservation.
addFlight
in class Reservation
f
- the Flight
instance
true
if successful; false
if duplicate flight
IllegalStateException
- if the reservation has already been purchased.public boolean addTraveler(String name) throws IllegalStateException
Reservation
true
if successful; false
if this traveler was already on the reservation.
addTraveler
in class Reservation
name
- The name of the traveler
true
if successful; false
if duplicate
IllegalStateException
- if the reservation has already been purchased.public boolean purchase() throws IllegalStateException
true
if successful; false
otherwise.
IllegalStateException
- if the reservation was already
purchased or if there are zero travelers or zero legs.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |