hts.StevenWood.com

[ Last Page ]

Karel 7b

Complete the following in class or for homework.

1. Create a new class RememberingRobot (RR) which is a child of the Robot class. This new robot will have an attribute (also known as an instance variable) that keeps track of how many Things it has picked up. Name the attribute pickedThings 

Override the pickThing method of the RR class, to increase the attribute (instance variable) by one and then pick up the Thing. 

Display the value of items picked up on the back of the robot.

Start your robot at avenue 0 and street 6 facing North. Instruct your robot to move north and pick up a Thing at each of the 4 corners above it. Your robot should stop at avenue 0, street 0. Use the city file Victoria.txt.

Test your program thoroughly. Document task code and new robot class properly.

Do NOT hand in your work unless other instructions were given.

Challenge:

1) Create a new method and have RR pick up all of the items on an intersection. Display the information on the back of RR.

 

 
[Last Page]
All material on this site is copyright © 1997- by Steven Wood or as credited. All right reserved. Use of this site indicates you agreement with the  terms of use.
Send comments or questions to about this page.
Every attempt has been made to credit work under copyright. If there are any claims that copyright has been missed please contact the .
+SDG+