Name: __________________
Quiz
1. Method that initializes a class is called: ________________________________________
2. To protect an object variable from an invalid value you write a _____________________ method
3. class:object = script:____________________________
Lab Instructions
-
Create a project called SolarSystem
-
Import the files from R:\AP Java\Projects\Lab 14 Solar System. The files you will be importing include the Main and template files for the celestial object classes.
- Complete the object classes according to the following description:
-
Rocky planets have several attributes
-
Are represented by an earth-tone circle..
-
Have a circular moon
-
Rocky planets have several behaviours
-
Can return their location to the client
-
Can move
-
Can report whether they contain a location
-
Can be toggled, which changes the moon, somehow.
-
Gaseous planets have several attributes:
-
Are represented by a sky-tone circle.
-
Have a circular ring around the planet
-
Have location
-
Gaseous planets have several behaviors
- Can return their attributes to the client
-
Can move
-
Can report whether they contain a location
-
Can be toggled, which changes the ring, somehow
-
Modify the applet code in Main to do the following.
-
Create one rocky and one gaseous planet at the start of the program
-
If the user clicks on a planet, toggle it.
-
If the user clicks on the background, create a new planet at the clicked location. Althernate between the two planet types.
-
Print and hand in these instructions.
Grading
| |
Points |
Out of |
Notes |
|
Quiz
|
|
3
|
|
|
Rocky Class
|
|
8
|
|
|
Gaseous Class
|
|
8
|
|
|
Applet behavior
|
|
6
|
|
|
Total
|
|
25
|
|
Notes
Comments (0)
You don't have permission to comment on this page.