evacuation
Class Evacuee

java.lang.Object
  extended by evacuation.Evacuee
All Implemented Interfaces:
java.lang.Comparable<Evacuee>

public class Evacuee
extends java.lang.Object
implements java.lang.Comparable<Evacuee>

Objects of this class represent people fleeing a sinking ship.

Author:
You

Constructor Summary
Evacuee(java.lang.String fname, java.lang.String lname, boolean male, int age, int income)
          Constructs a newly allocated Evacuee with the specified information
 
Method Summary
 int compareTo(Evacuee rhs)
          Compares two Evacuees based on priority as described in Assignment2.doc
 java.lang.String toString()
          Returns a String describing this evacuee in a format similar to the following
Leonardo DiCaprio (Male, age 23, income $70)
The String should not contain any line separators.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Evacuee

public Evacuee(java.lang.String fname,
               java.lang.String lname,
               boolean male,
               int age,
               int income)
Constructs a newly allocated Evacuee with the specified information

Parameters:
fname - The Evacuee's first name
lname - The Evacuee's last name
male - A boolean value indicating whether or not the Evacuee is male or female (true means male, false means female)
age - The Evacuee's age in years
income - The Evacuee's annual income in US$
Method Detail

compareTo

public int compareTo(Evacuee rhs)
Compares two Evacuees based on priority as described in Assignment2.doc

Specified by:
compareTo in interface java.lang.Comparable<Evacuee>
Parameters:
rhs - The other Evacuee to be compared
Returns:
0 if the Evacuees have equal priority, a value less than 0 if this Evacuee has higher priority(should get onto a lifeboat first), or a value greater than 0 if this Evacuee has lower priority

toString

public java.lang.String toString()
Returns a String describing this evacuee in a format similar to the following
Leonardo DiCaprio (Male, age 23, income $70)
The String should not contain any line separators.

Overrides:
toString in class java.lang.Object
Returns:
The String representation of this Evacuee