View
 

Lab 20: Solar System VIII

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

Name: ___________________________________________________________________

Objective: Passing objects to methods

Instructions:

  1. Open your Solar System Lab
  2. Import the files from Lab 20 Solar System VIII. You will be importing two files: a new applet file and a class called Blackhole.
  3. Be sure your Spacecrafts have methods that can return their current location.
  4. Modify the Blackhole class as follows:
    1. Black holes are hollow white circles created in the center of the canvas. Every black hole should be the same size.
    2. Black holes can report if a location is contained within itself.
    3. Black holes have a methof called pull, which takes one Spacecraft object. The pull method moves the spacecraft half-way towards the black hole.
  5. Modify the applet as follows:
    1. Create two different spacecraft objects. Start their animation,.
    2. If the user clicks within the black hole, pull the two spacecraft towards it.

Grading

Feature  Points  Out of  Notes 
Blackhole class  
 
Applet   
 
Total   10  

 Notes

 
 
 
 
 
 

 

 

 

Comments (0)

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