hts.StevenWood.com

Karel 5

Home ] Up ] Karel 1 ] Karel 1b ] Karel 2 ] Karel 2b ] Karel 3 ] Karel 4 ] [ Karel 5 ] Karel 5b ] Karel 6 ] Karel 6b ] Graphics: Types some words ] Graphics: Spell your name ] Graphics: Fall scene ][ Last Page ]

Karel 5

Complete the following in class or for homework.

1.

You would like to send a greeting to astronauts in the International Space Station orbiting Earth. Create these robots by extending the RobotSE class. The robots can be used to "write" the message "Hello" by lighting bonfires (Things). The final situation is shown below. There are 4 types of  robots:

  • one that makes an "H",
  • one that makes an "E",
  • one that makes an "L" (note that you will need two of these), and
  • one that makes an "O".

a) Write a RobotTask program that uses 5 robots, one for each letter. Instantiate each robot with sufficient Things in its backpack. (Check the documentation for the Robot class for details on the proper constructor.) Hint: add a 5th item on the constructor line. This item represents the number of items (Things) that start in the backpack.


e.g. Robot blah = new Robot ( nyc, 1, 7, Direction.NORTH, 5 )

b) Set the size of the city

The default window for the city is too small to see the entire message. With the following City contructor you can set the size of the window to match the size of the message:


e.g. City blah = new City ( numVisibleStreets, numVisibleAvenues )

Test your programs thoroughly. Document your task code properly.

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

 
 
Home ] Up ] Karel 1 ] Karel 1b ] Karel 2 ] Karel 2b ] Karel 3 ] Karel 4 ] [ Karel 5 ] Karel 5b ] Karel 6 ] Karel 6b ] Graphics: Types some words ] Graphics: Spell your name ] Graphics: Fall scene ][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+