JMUPhoneNumber class is an encapsulation of a
telephone number at James Madison University.
JMUPhoneNumber class is summarized in
the following UML class diagram.
Other details are provided below.
public static final int US_OLD = 0;
public static final int US_NEW = 1;
public static final int EUROPE = 2;
public static final int JMU = 3;
public static final int OFFICE = 568;
public static final int DORM = 612;
areaCode - An int containing the area code.exchange - An int containing the three-digit
exchange (i.e., 568 for offices or 612 for
dormitories).extension - An int containing the extension
(i.e., the last four digits of the
phone number).format - An int containing the format to
be used by the toString method.It may contain other attributes as well.
/**
* Default Constructor.
*
* Constructs a JMUPhoneNumber with the areaCode set to 540,
* the exchange set to 568, the extension set to 6211, and the
* format set to JMU
*/
public JMUPhoneNumber()
{
}
/**
* Checks if this JMUPhoneNumber is in a dorm.
*
* @return true if in a dorm and false otherwise
*/
public boolean isDorm()
{
}
/**
* Checks if this JMUPhoneNumber is in an office.
*
* @return true if in an office and false otherwise
*/
public boolean isOffice()
{
}
/**
* Sets the exchange associated with this JMUPhoneNumber.
*
* Note: If the parameter is not valid this method sets the
* exchange to OFFICE
*
* @param exchange The exchange (either OFFICE or DORM)
*/
public void setExchange(int exchange)
{
}
/**
* Sets the extension associated with this JMUPhoneNumber.
*
* Note: If the parameter is not valid this method sets the
* extension to 6211
*
* @param extension The extension (between 0000 and 9999)
*/
public void setExtension(int extension)
{
}
/**
* Sets the format to be used by the toString method.
*
* The valid formats along with examples are:
*
* US_OLD (540) 568-6211
* US_NEW 540-568-6211
* EUROPE 540.568.6211
* JMU x8-6211
*
* Note: If the parameter is not valid this method sets the
* format to JMU
*
* @param format A valid format
*/
public void setFormat(int format)
{
}
/**
* Returns a formatted String representation of this JMUPhoneNumber
* (see the discussion of the setFormat method).
*
*/
public String toString()
{
}
Copyright 2017