public class Mailbox extends java.lang.Object
Constructor and Description |
---|
Mailbox(java.lang.String aPasscode,
java.lang.String aGreeting)
Creates Mailbox object.
|
Modifier and Type | Method and Description |
---|---|
void |
addMessage(Message aMessage)
Add a message to the mailbox.
|
boolean |
checkPasscode(java.lang.String aPasscode)
Check if the passcode is correct.
|
Message |
getCurrentMessage()
Get the current message.
|
java.lang.String |
getGreeting()
Get the mailbox's greeting.
|
Message |
removeCurrentMessage()
Remove the current message from the mailbox.
|
void |
saveCurrentMessage()
Save the current message
|
void |
setGreeting(java.lang.String newGreeting)
Change mailbox's greeting.
|
void |
setPasscode(java.lang.String newPasscode)
Change mailbox's passcode.
|
public Mailbox(java.lang.String aPasscode, java.lang.String aGreeting)
aPasscode
- passcode numberaGreeting
- greeting stringpublic boolean checkPasscode(java.lang.String aPasscode)
aPasscode
- a passcode to checkpublic void addMessage(Message aMessage)
aMessage
- the message to be addedpublic Message getCurrentMessage()
public Message removeCurrentMessage()
public void saveCurrentMessage()
public void setGreeting(java.lang.String newGreeting)
newGreeting
- the new greeting stringpublic void setPasscode(java.lang.String newPasscode)
newPasscode
- the new passcodepublic java.lang.String getGreeting()