School of Engineering and Applied Science
Department of Computer Science
CSci 53 -- Introduction to Software Development
http://www.seas.gwu.edu/~csci53/spring03
Prof. Michael B. Feldman
mfeldman@gwu.edu

Lab Exercise #4
Thursday, Feb. 6, 2003

Objectives: This exercise will help you explore Java's random-number facility.

Part I.

Copy and compile programs53/RandomNumbers.java. Examine the listing file, then run the program and make sure you understand its behavior.

Part II.

Write an application that creates and displays a random phone number of the form XXX-XXX-XXXX. Include the dashes in the output. Do not let the first three digits contain an 8 or 9 (but don't be more restrictive than that), and make sure that the second set of three digits is not greater than 742. Hint: Think through the easiest way to construct the phone number. Each digit does not have to be determined separately.

(end of lab)