| CSCI A201/A597Problem Set Four Second Summer 2000 |
| 1. | Write a graphics program that draws your name in red, centered inside a blue rectangle. |
| 2. | Write a graphics program that draws your name four times, in a large serif font, in plain, bold, italic, and bold italic. The names should be stacked on top of each other, with equal distance between them. Each of them should be centered horizontally, and the entire stack should be centered vertically. |
| 3. |
Write a graphics program that draws twelve strings, one each for the 12
standard colors beside Color.white, each in its own color.
|
| 4. | Write a graphics program that prompts the user to enter a radius. Draw a circle with that radius. |
| 5. | Write a program that draws two solid circles, one in pink and one in purple. Use a standard color for one of them and a custom color for the other. |
| 6. |
Draw a "bull's eye" -- a set of concentric rings in alternating red and
white colors. Hint: Fill a red circle, then fill a smaller white
circle on top, and so on.
|
| 7. | Write a program that fills the applet window with a large ellipse, filled with your favourite color, that touches the window boundaries. The ellipse should resize itself when you resize the window. |
| 8. |
Write a program that draws the picture of a house. It could be as simple
as the figure below, or if you like, make it more elaborate (3-D, skyscraper,
marble columns in the entryway, whatever).
|
| 9. |
Write a program to plot the following face.
|
| 10. |
Write a program to plot the string "HELLO," using just lines
and circles. Do not call drawString, and do not
use System.out.
|
| 11. |
Plotting a data set. Make a bar chart to plot
the following data set:
Make the bars horizontal for easier labeling. Hint: Set the window coordinates to 5,000 in the x-direction and 4 in the y-direction.
|
| 12. | Write a graphics program that displays the values of exercise 4.11 as a pie chart. |
| 13. |
Write a program that displays the Olympic rings.
Make the rings colored in the Olympic colors. |
| 14. |
Write a graphics program that draws a clock face with a time that
the user enters in a text fiels. (The user must enter the time in
the format hh:mm, for example 09:45). Hint: You need to find out the angles of the hour hand and the minute hand. The angle of the minute hand is easy: The minute hand travels 360 degrees in 60 minutes. The angle of the hour hand is harder; it travels 360 degrees in 12 x 60 minutes. |
| 15. |
Change the CarDrawer program to make the car appear twice
the size of the original example.
|
| 16. |
Design a class Car whose constructor takes
the top left corner point of the car. Supply a method
that draws the car. Then populate your screen with a few cars.draw(Graphics2D g2) |
| 17. |
Extend Exercise 4.8 by implementing a class House. In the
constructor of the House class, supply the bottom left corner
of the house and its width and height. Supply a method
that draws the house. Then populate your screen with a few houses of different sizes.draw(Graphics2D g2) |