airline
Class Passenger

java.lang.Object
  extended by airline.Passenger

public class Passenger
extends java.lang.Object


Constructor Summary
Passenger()
          Creates a new instance of Passenger.
Passenger(java.lang.String last, java.lang.String first)
          Creates a new instance of Passenger - we only know their name.
Passenger(java.lang.String last, java.lang.String first, java.lang.String addr, java.lang.String cty, java.lang.String stat, java.lang.String zp)
          Creates a new instance of Passenger - we know their name and address.
Passenger(java.lang.String last, java.lang.String first, java.lang.String addr, java.lang.String cty, java.lang.String stat, java.lang.String zp, java.lang.String ffType)
          Creates a new instance of Passenger - we know their name and address and frequent flyer type.
Passenger(java.lang.String last, java.lang.String first, java.lang.String addr, java.lang.String cty, java.lang.String stat, java.lang.String zp, java.lang.String ffType, Airport home)
          Creates a new instance of Passenger - we know their name and address and frequent flyer type and home airport.
 
Method Summary
 boolean addFreqFlyerPts(int pts)
          add to number of frequent flyer points - given only number of points to add So far, just check that points are positive - really need more careful checking
 boolean addFreqFlyerPts(Route rt)
          add to number of frequent flyer points - given a Route flown.
 boolean deductCrossCountryTrip()
          deduct number of points needed for a cross country trip return false if not enough points in account.
 boolean deductInternationalTrip()
          deduct number of points needed for an international trip return false if not enough points in account.
 boolean deductRegionalTrip()
          deduct number of points needed for a short or regional trip return false if not enough points in account.
 boolean deductUpgrade()
          deduct number of points needed for a first class upgrade.
 java.lang.String getCity()
          report city
 edu.lasalle.redmond.IDs.Id getCustomerID()
          report customer id
 java.lang.String getFirstName()
          report first name
 int getFreqFlyerPts()
          report current number of frequent flyer miles
 java.lang.String getFreqFlyerType()
          report frequent flyer type.
 Airport gethomeAirport()
          report passenger's "home" airport
 java.lang.String getLastName()
          report last name
 java.lang.String getState()
          report state
 java.lang.String getStreetAddr()
          report street address
 java.lang.String getZip()
          report zip code
 void setCity(java.lang.String cty)
          change passengers city - hard to validate
 boolean setCustomerID(edu.lasalle.redmond.IDs.Id custID)
          change customer ID.
 void setFirstName(java.lang.String first)
          change passengers first name - hard to validate
 boolean setFreqFlyerPts(int pts)
          change number of frequent flyer points - should probably make private and have more controlled methods So far, just check that points are positive - really need more careful checking
 boolean setFreqFlyerType(java.lang.String fft)
          change frequent flyer type.
 boolean setHomeAirport(Airport home)
          change passengers home airport.
 void setLastName(java.lang.String last)
          change passengers last name - hard to validate
 boolean setState(java.lang.String stat)
          change passengers state - check length.
 void setStreetAddr(java.lang.String addr)
          change passengers street address - hard to validate
 boolean setZip(java.lang.String zp)
          change passenger zip code.
 java.lang.String toShortString()
          Provide brief info about the passenger
 java.lang.String toString()
          converts route into a string represention.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Passenger

public Passenger()
Creates a new instance of Passenger. Without any info, can only assign a random 5 digit customer ID


Passenger

public Passenger(java.lang.String last,
                 java.lang.String first)
Creates a new instance of Passenger - we only know their name. Their customerID is randomly generated; the rest of the info is left unknown.


Passenger

public Passenger(java.lang.String last,
                 java.lang.String first,
                 java.lang.String addr,
                 java.lang.String cty,
                 java.lang.String stat,
                 java.lang.String zp)
Creates a new instance of Passenger - we know their name and address. Their customerID is randomly generated;


Passenger

public Passenger(java.lang.String last,
                 java.lang.String first,
                 java.lang.String addr,
                 java.lang.String cty,
                 java.lang.String stat,
                 java.lang.String zp,
                 java.lang.String ffType)
Creates a new instance of Passenger - we know their name and address and frequent flyer type. Their customerID is randomly generated;


Passenger

public Passenger(java.lang.String last,
                 java.lang.String first,
                 java.lang.String addr,
                 java.lang.String cty,
                 java.lang.String stat,
                 java.lang.String zp,
                 java.lang.String ffType,
                 Airport home)
Creates a new instance of Passenger - we know their name and address and frequent flyer type and home airport. Their customerID is randomly generated;

Method Detail

getCustomerID

public edu.lasalle.redmond.IDs.Id getCustomerID()
report customer id


getLastName

public java.lang.String getLastName()
report last name


getFirstName

public java.lang.String getFirstName()
report first name


getStreetAddr

public java.lang.String getStreetAddr()
report street address


getCity

public java.lang.String getCity()
report city


getState

public java.lang.String getState()
report state


getZip

public java.lang.String getZip()
report zip code


getFreqFlyerType

public java.lang.String getFreqFlyerType()
report frequent flyer type. Should move to enumerated type later


getFreqFlyerPts

public int getFreqFlyerPts()
report current number of frequent flyer miles


gethomeAirport

public Airport gethomeAirport()
report passenger's "home" airport


setCustomerID

public boolean setCustomerID(edu.lasalle.redmond.IDs.Id custID)
change customer ID. Should probably be stricter since we have the id class to rely on. So far just check that it is the correct length (5)


setLastName

public void setLastName(java.lang.String last)
change passengers last name - hard to validate


setFirstName

public void setFirstName(java.lang.String first)
change passengers first name - hard to validate


setStreetAddr

public void setStreetAddr(java.lang.String addr)
change passengers street address - hard to validate


setCity

public void setCity(java.lang.String cty)
change passengers city - hard to validate


setState

public boolean setState(java.lang.String stat)
change passengers state - check length. returns false if not two chars. Should do a lookup of possible values


setZip

public boolean setZip(java.lang.String zp)
change passenger zip code. Only check length (5 or 9 acceptable)


setFreqFlyerType

public boolean setFreqFlyerType(java.lang.String fft)
change frequent flyer type. Check for appropriate value (should be enumberated type later.


setFreqFlyerPts

public boolean setFreqFlyerPts(int pts)
change number of frequent flyer points - should probably make private and have more controlled methods So far, just check that points are positive - really need more careful checking


deductUpgrade

public boolean deductUpgrade()
deduct number of points needed for a first class upgrade. return false if not enough points in account. Really should depend on frequent flyer type, but we don't have that yet


deductRegionalTrip

public boolean deductRegionalTrip()
deduct number of points needed for a short or regional trip return false if not enough points in account. Really should depend on frequent flyer type, but we don't have that yet


deductCrossCountryTrip

public boolean deductCrossCountryTrip()
deduct number of points needed for a cross country trip return false if not enough points in account. Really should depend on frequent flyer type, but we don't have that yet


deductInternationalTrip

public boolean deductInternationalTrip()
deduct number of points needed for an international trip return false if not enough points in account. Really should depend on frequent flyer type, but we don't have that yet


addFreqFlyerPts

public boolean addFreqFlyerPts(int pts)
add to number of frequent flyer points - given only number of points to add So far, just check that points are positive - really need more careful checking


addFreqFlyerPts

public boolean addFreqFlyerPts(Route rt)
add to number of frequent flyer points - given a Route flown. Don't know if there is validation that should be done. I have mixed feeling about passenger depending on the existence of Route.


setHomeAirport

public boolean setHomeAirport(Airport home)
change passengers home airport. Right now, can't validate - need Collection of airports - but it is unclear if passenger class should depend on having that


toString

public java.lang.String toString()
converts route into a string represention. Overrides Object version

Overrides:
toString in class java.lang.Object

toShortString

public java.lang.String toShortString()
Provide brief info about the passenger