CS110 Introduction to Computing
Spring 2006
Assignment#3: Modeling using Objects
Due in class on Thursday, February 9, 2006
You have now learned the basics of object-oriented programming: objects, classes,
methods, etc. And you have also been introduced to the Wheels library. Using
the Wheels library and the knowledge you have gained so far, in this exercise
you will exercise your creative side as well.
What to do: Write a Java program that displays a simple cartoon.
In the cartoon, feel free to include any sketches designed using the primitives
available in the wheels package. For example, spaceships, faces, houses, robots,
etc. You cartoon must display at least two characters, at least one of which
must be composed of four or more smaller shapes, plus a cartoon bubble for
each character. In addition, you may also experiment with images
Notes:
- Be sure that you have carefully read and understood the concepts covered
in Chapters 0-2 ofr Sanders & van Dam and also the Lab Manual and the class
notes.
- While the shapes in the wheels library may see too simplistic or primitive,
you can do quite a bit by combining these shapes and colors.
- Be aware that drawing shapes over each other occludes the shapes overwritten.
This can be exploited to create interesting shapes and effects (see programming
exercise #3 on page 94 of your text, for example).
- Please, ensure that your cartoon is in good taste and not offensive.
Hand in: A prinout of the Java program from
above. Also, include a prinout of the cartoon produced by your program. Instructions
for printing the picture Frame are given below. Conclude your work by a short
essay (just a few sentences) on your thoughts about your understanding of the
Java programming concepts you have learned so far.
Also: As soon as you are successfully done,
send an email to Deepak telling him that you were able to successfully complete
your assignment.
How to print the Frame window:
- Run the program so the Frame window is being displayed on your screen.
- Open up another terminal window (Applications -> System Tools -> Terminal)
and position it so that it does not overlap with the Frame window (you may
need to move the Frame window as well).
- In the terminal window, go into your cs110 directory (using the command cd
cs110). This way the image of the Frame window will be stored
here.
- In the terminal window, enter the command: import -frame SomeName.png (that
is "minus frame" following the import command). As soon as you hit the return
key, the mouse cursor will change to a "crosshair". Move it to the Frame
window and click it once. There will be a short delay and you will hear two
quick beeps.
- You just took a snapshpt of the Frame window and saved in in the file (whatever
you specified for SomeName.png). You can insert this image
in any Word or Word-like document and then print it. For example, Linux has
a powerful document editing system (that is compatible with Microsoft Word)
called OpenOffice Writer. You can open it using the menu option: Applications
-> Office -> OpenOffice.org Writer
- The nice thing about OpenOffice is that unlike Microsfot Word which costs
several hundred $$ OpenOffice is free. Since it works just like Word, you
can use it to write all your reports and papers.
Your assignment will be graded based on your ability to satisfy the requirements
listed above including your proper use and modeling of objects/classes and
their relationships.
Back to CS110 Spring 2006 Materials.