Homework for Using Classes

1. Write a Queue class that holds ints. It should have an enqueue() method which places an int at the back of the queue, and a dequeue() method which takes an int off the front of the queue and returns its value. It should also have an empty() method which returns a boolean value, true if the queue is empty, false if it's not.

2. Write an applet which prints your name in red on a black background.

3. Write an applet which draws a picture of a house. Make it pretty. Sign your work.

4. Write an applet that draws lines from the left edge of the applet towards the right. The lines should be 1 pixel apart, and they should go down the entire height of the applet. The length of each line should be equal to it's vertical position. For example, the following pairs of points represent the lines you should draw for an applet with a height and width of 10 pixels:


Return to: Using Classes

Next Lesson: Advanced Classes

Return to the Main Menu.