139 lines
3.3 KiB
Java
139 lines
3.3 KiB
Java
/**
|
|
* <PRE>
|
|
* Mail.java
|
|
*
|
|
* Revisions: 1.0 Oct. 01, 2002
|
|
* Created the Mail class
|
|
* 1.1 Oct. 05, 2002
|
|
* Finished, Compiled, Commented
|
|
*
|
|
* </PRE>
|
|
*
|
|
* Collaboration Statement:
|
|
* I worked on the homework assignment alone, using only
|
|
* course materials.
|
|
*
|
|
* Created with JCreatorLE, some indents are off when viewed through notepad
|
|
* or EMACS
|
|
*
|
|
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
|
* @version Version 1.1, Oct. 01, 2002
|
|
*/
|
|
|
|
public class Mail implements P3Type{
|
|
|
|
public static final boolean bDebug = false; //there's nothing to debug
|
|
//that bDebug can handle
|
|
|
|
private String strFrom;
|
|
private String strTo;
|
|
private String strMessage;
|
|
|
|
////////////////
|
|
//Constructors//
|
|
////////////////
|
|
|
|
/**
|
|
*Constructor for mail
|
|
*@param strMessage, the message value
|
|
*@param strFrom, who sent the message
|
|
*@param strTo, who the message will be sent to
|
|
*/
|
|
public Mail(String strMessage, String strFrom, String strTo){
|
|
//I prefer to use the this. references for the constructors
|
|
//rather than referencing the accessor/modifiers
|
|
//either way is correct according to lecture, its just
|
|
//a matter of just how encapsulated it should be
|
|
this.strMessage = strMessage;
|
|
this.strFrom = strFrom;
|
|
this.strTo = strTo;
|
|
}//end Mail(message,from,to)
|
|
|
|
///////////////////////
|
|
//Accessors/Modifiers//
|
|
///////////////////////
|
|
|
|
/**
|
|
*Modifier for strFrom
|
|
*@param strFrom the value to set this.strFrom to
|
|
*/
|
|
public void setStrFrom(String strFrom){
|
|
this.strFrom = strFrom;
|
|
}
|
|
|
|
/**
|
|
*Accessor for strFrom
|
|
*@return value of strFrom
|
|
*/
|
|
public String getStrFrom(){
|
|
return strFrom;
|
|
}
|
|
|
|
/**
|
|
*Modifier for strTo
|
|
*@param strTo, the value to set for this.strTo
|
|
*/
|
|
public void setStrTo(String strTo){
|
|
this.strTo = strTo;
|
|
}
|
|
|
|
/**
|
|
*Accessor for strTo
|
|
*@return the value of strTo
|
|
*/
|
|
public String getStrTo(){
|
|
return strTo;
|
|
}
|
|
|
|
/**
|
|
*Modifier for strMessage
|
|
*@param strMessage the value to set this.strMessage to
|
|
*/
|
|
public void setStrMessage(String strMessage){
|
|
this.strMessage = strMessage;
|
|
}
|
|
|
|
/**
|
|
*Accessor for strMessage
|
|
*@return the value of strMessage
|
|
*/
|
|
public String getStrMessage(){
|
|
return strMessage;
|
|
}
|
|
|
|
///////////
|
|
//Methods//
|
|
///////////
|
|
|
|
public String toString(){
|
|
return ("To: " + strTo + "\nFrom: " + strFrom +
|
|
"\nMessage: " + strMessage);
|
|
}
|
|
|
|
/******************************************************/
|
|
|
|
/**
|
|
* Debugging main for class Mail.
|
|
* This method will rigorously test my code.
|
|
*
|
|
* <br><br>
|
|
* @param args a String array of command line arguments.
|
|
*/
|
|
public static void main(String[] args) {
|
|
Mail box = new Mail("Screw You","Bob","Rob");
|
|
System.out.println(box);
|
|
|
|
box.setStrMessage("I love you");
|
|
box.setStrFrom("Rob");
|
|
box.setStrTo("Bob");
|
|
|
|
System.out.println(box);
|
|
|
|
System.out.println(box.getStrTo());
|
|
System.out.println(box.getStrFrom());
|
|
System.out.println(box.getStrMessage());
|
|
|
|
}// end of main(String[] args)
|
|
|
|
}// end of class Mail
|