Chapter 6 Homework
Monday, April 3rd, 2006Page 497, Problem #1
Page 497, Problem #3
Page 498, Problem #7
Page 497, Problem #1
Page 497, Problem #3
Page 498, Problem #7
Write a game to play poker with 2-4 players.
You can check out some basic rules for Texas Hold’ em.
Page 413, Problem #6
Page 413, Problem #7
I’ve created an area for you to download the in class examples.
Page 412, Problem #1
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);
}
Page 312, Problem #8
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.
Page 311 Problem #5
Download from http://www.eclipse.org/.
Install the application.
Run the application.
Select the workspace you would like to work in.
File -> New… -> Project…
Java Project
Next
Enter a project name.
Next
Finish
Right Click on the Project folder
New… -> Class
Enter the name of the class (java class)
Check the ‘public static void main(String [] arg)’ option if this is the main class.
Code away.
Bad Behavior has blocked 25 access attempts in the last 7 days.