Class date: November 18
HW: JM pg 232, #15 & 16; read the remainder of the chapter.
Objective: Write a method that turns a number into a String.
Warm-up: Name that Athlete

Create a new project called NameThatAthlete in which only partially recognizable names of
athletes are to be produced. In a real implementation of this game, the idea is for a contestant
to be able to guess the real name of the athlete after the first two and last three letters are
dropped from the name. We have been given the task of testing the feasibility of this idea by
producing the following printout:
(Use current, popular athletes, these are old and mostly dead actors!)
Allan Alda>>>lan A //living
John Wayne>>>hn Wa //dead
Gregory Peck>>>egory P //dead
Begin your code within the main method as follows:
String s1 = “Allan Alda”; //Use your favorite athletes names, unless you prefer
String s2 = “John Wayne”; //old dead movie stars!
String s3 = “Gregory Peck”;
Apply the length and substring methods to these Strings to produce the above printout.
Share your NameThatAthlete “game” with a buddy. Can you guess their athletes?
NEXT: Class share. Senior and Junior teams write your methods (from yesterday) on the board, explain methods used. Q & A. T-P-S.
NEW:
8.5: Three ways to format integers into Strings
- Concatenate
- toString method (Integer class)
- valueOf method (String class)
- Converting a double into a string
- import java.text.DecimalFormat;

- PrintStream and PrintWriter

- Refer to Java API documentation for printf formatting. There’s a lot!
- import java.text.DecimalFormat;
8.6 Extracting Numbers from Strings
- parseInt
- parseDouble
- NumberFormatException
8.7 Character Methods-to find out if a particular character is a digit, a letter, or something else.
boolean result = Character.isDigit(c); //result is true if c is a digit, else false
Other “characters”
- isLetter
- isLetterOrDigit
- isUpperCase, isLowerCase
- isWhitespace
Time permitting-Class Lab: Lipograms, pg 224-226. Check school email for files.