|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--Job
|
+--Crewman
Parent class the groups both Navigator and Security
Contains the methods that will be used by both
| Field Summary | |
static int |
MAXPENDING
|
| Fields inherited from class Job |
ADMIRAL, CAPTAIN, ENGINEER, NAVIGATOR, SECURITY, titles |
| Constructor Summary | |
Crewman(int rank)
Creates a new Crewman |
|
| Method Summary | |
boolean |
completeOrder()
Will complete the current order by removing the current order and assigning the next pending order. |
void |
executeSession(Person user)
Prints the Crewman menu and then retrieves the user's input. |
Order |
getCurrentOrder()
returns the Crewman's current order |
boolean |
giveOrder(Order newOrder)
Method that assigns an order to the Crewman from a superior officer. Things to note: * If a Crewman has no current order, then the newOrder will become the Crewman's current order * A Crewman can only accept certain orders, as defined by the possibleOrders[rank] array * You MUST use the OrderIterator class to iterate through the pending orders * Orders MUST be inserted into the pendingOrders array in order or Priority * Example: A Crewman has 2 pending orders, 1 High and 1 Low. |
java.lang.String |
printPendingOrders()
Returns a string of all the pending orders for the caller to print You MUST use an ObjectIterator to iterate through the pending orders |
boolean |
setSuperiorOfficer(Person officer)
Sets the Crewman's Superior Officer. |
java.lang.String |
toString()
Returns a string describing the Crewman class. |
| Methods inherited from class Job |
getRank, issueOrder, whichOrders |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int MAXPENDING
| Constructor Detail |
public Crewman(int rank)
rank - - value given from the child class that defines which rank the instance is. Value is a constant that is referenced in Job.java| Method Detail |
public boolean setSuperiorOfficer(Person officer)
officer - - The officer that will become the user's Superior Officer
public Order getCurrentOrder()
public boolean giveOrder(Order newOrder)
giveOrder in class JobnewOrder - Order to be executed
public boolean completeOrder()
public java.lang.String printPendingOrders()
public void executeSession(Person user)
Crewman menu: 1. Print Current Order 2. Print Pending Orders 3. Complete Order 4. Log Off What would you like to do?If a user wants to complete an order, then print the success/failure of that command.
executeSession in class Jobuser - An instance of the callerpublic java.lang.String toString()
toString in class Job
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||