If you don't remember how to do any of the steps (like, copying, zipping, etc), please refer back to Lab 1.
First, you will need to copy over the scenario for this assignment. If you are working from home, you can download the scenario here. If you are in lab, the scenario is located in /eng/class/notes/cse113/scenarios/PracticeAssignment5.
Take note of the following classes in the scenario:
You are to complete the following functionality for the scenario.
Fill in the checkForVirus method so that if the VirusPatrol can see a Virus, it turns away from it. You can specify how many degrees to turn (it can be random if you'd like).
Modify the constructor in the Body class to create 10 viruses and 1 virus patrol and put each of them in the world at random locations.
Add an instance variable to the VirusPatrol class to count the number of viruses the virus patrol has run into. Create a constructor for the VirusPatrol class and initialize the instance variable to zero inside the constructor. Modify your code in checkForViruses so that when the virus patrol can see a virus, the count is increased by 1.
You will once again modify thwe checkForViruses code so that after a virus has been hit and the counter updated and the patrol turned, the patrol checks the value of the instance variable. If the value is greater than or equal to 10, then the image of the virus patrol should change to skull.png.
Once you have finished your changes to the code, you will submit the zipped up version of the practice assignment 5 scenario.
For directions on submitting, please see here.
This practice assignment is due on Friday, March 18th at 11:59:59pm.
Please make sure to look at your grading information on Web-CAT. See the grading information page for more details about how to interpret Web-CAT grade reports. (At this time, the Web-CAT grading is not enabled for this assignment.)
The following tests were run on your assignment submission. Each test was given equal weight, so 20 points each part.
Lab authored by Adrienne Decker