CollectNewspaperKarel - import stanford.karel public class...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * File: * -------------------------------- * At present, the CollectNewspaperKarel subclass does nothing. * Your job in the assignment is to add the necessary code to * instruct Karel to walk to the door of its house, pick up the * newspaper (represented by a beeper, of course), and then return * to its initial position in the upper left corner of the house.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: */ import stanford.karel.*; public class CollectNewspaperKarel extends SuperKarel { public void run() { pickNewspaper(); pickBeeper(); returnBack(); } private void pickNewspaper(){ turnRight(); move(); turnLeft(); move(); move(); move(); } private void returnBack(){ turnAround(); move(); move(); move(); turnRight(); move(); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online