Examples
- Human.java - one class, two
instances; picture: The Human Class
and Objects
- Point.java - invoking methods
on objects; picture: The Point
Class and Objects
- Bicycle.java - a class, a
static field, two objects; picture: A Bicycle Class
|
Lab08
- Exercise 8.2. The program shall meet the following
additional requirements:
- classname: Complex.
- It shall be an application; i.e., it shall have a main()
method.
- The main() method shall test the class as
follows:
- It shall create two Complex objects, z
= (1, 2) and w = (3, 5).
- It shall print z, w, z
+ w, and z - w.
- If you don't understand complex numbers, you can do exercise
8.3 instead.
- Exercise 8.8. The program shall meet the following additional
requirements:
- class name: Rectangle.
- It shall be an application; i.e., it shall have a main()
method.
- The main() method shall test the class as
follows:
- It shall create two Rectangle objects, rect1
with default dimensions and rect2
with length 3 and width 2.
- It shall print a descriptive representation of rect1
and rect2.
Note 1: Be sure to make use of the message passing nature of OOP. Create
objects that model real-world objects. Manipulate those objects in a
way that simulates the way you would manipulate their real-world
counterparts. Note 2: You have two weeks to complete this
assignment. (Due: 11/02/2004) |