View
 

Lab 17: Solar System V

Page history last edited by Mr. Kretsch 3 months, 2 weeks ago

Name: _______________

Quiz

Assume this lab was to re-engineer Solar System to add a Planet class that would be the base class for Rocky and Gaseous. What methods and variables would Planet have?

 
 
 
 
 

Objective

To add to our Solar System project an inheritance hierarchy of spacecraft objects.

Instructions

  1. Open your Solar System project
  2. Import the files from Lab 17 Solar System V. You will be importing four files. The file Spacecraft.java is the base class for a set of spacecraft. The file Shuttle is a derived class from Spacecraft. The file GPS is a derived class from Spacecraft and represents a GPS satellite. Finally, Main5.java is the applet.
  3. Create the two Spacecraft types.
    1. Shuttles are represented by white, horizontally-oriented ellipse. 
    2. Satellites are gray, vertically-oriented ellipse topped by a circular dish. 
  4. Each spacecraft is to be created at a random location  within the drawing window.  Spacecraft can move to a specific location, they can report whether they contain a point, and they can be toggled, somehow.
  5. Update the applet class as follows
    1. Create one planet of each type. 
    2. Create one spacecraft of each type 
    3. When the user clicks on the object, toggle it.
    4. When the user clicks on the background, alternately move one of the two spacecraft to the clicked location.  

Wrap-Up

  1. Print the PDF version of these instructions and hand in

Design Considerations 

Consider what the two spacecraft classes have in common that would be candidates for the base class.

Grading

Requirement  Points  Out of  Note 
Quiz   2  
Spacecraft class - Does it contain the data and code appropriate to the parent class  
 
Shuttle and GPS classes - Do they contain the appropriate data and code for child classes. Do they make use of the parent class resources.   
 
Applet behavior  
 
Total  
15   

Notes

 
 
 
 

Comments (0)

You don't have permission to comment on this page.