ITSE 2317 Source Code
Tuesday, February 21st, 2006I’ve created an area for you to download the in class examples.
I’ve created an area for you to download the in class examples.
public boolean isValidPhone(String sAreaCode, String sPrefix, String sSuffix)
{
return this.isValidPhonePart(sAreaCode,3) && this.isValidPhonePart(sSuffix,4);
}
public boolean isValidPhonePart(String sValue, int iLength)
{
for(int iCounter = 0; iCounter < sValue.length(); iCounter++)
{
switch(sValue.charAt(iCounter))
{
case ‘0′:
case ‘1′:
case ‘2′:
break;
default:
return false;
}
}
return (sValue.length() == iLength);
}
Today we reviewed over creating optimized code by utilizing code reuse where ever possible.
There were questions over the programming assignment. Page 311, Problem #5.
Bad Behavior has blocked 25 access attempts in the last 7 days.