|
Fundamental Programming Concepts
Summer 2000 |
|
Overview |
This lab requires the use of:
|
Preliminary: Creating Applets in Metrowerks |
|
Part I: Poem |
Create an applet that displays a poem and a picture that relates to the poem. The poem may be lines from an actual poem, song, a quote, lines from a book, or any other text (e.g., it need not actually be a poem -- but do please name your class Poem anyway). The poem must be displayed using at least 3 lines of text. The picture should be created using at least four different methods from the Graphics class. Also, it should use at least 2 colors other than black and white. Don't be concerned about the artistic merit of your picture -- Java's drawing methods aren't terribly sophisticated. Don't steal the pictures from your text (snowmen and stick figures are right out).
|
Part II: SlotMachine |
Create an applet that simulates a simple slot machine. Three numbers between 0 and 9 should be randomly selected and then displayed in three different Labels. Provide a Button that, when clicked, changes the numbers (i.e., simulates pulling the handle on the machine). If all three numbers come up the same, the user should be rewarded with a message in a fourth Label. If two numbers are the same, the user should be told that
s/he is close, and to try again. Otherwise, the label should display a message encouraging the user to try again.
There is no need to keep track of money won or lost.
|
Submitting |
Submit exactly the following:
|