Karel J Robot
“Meet Karel J Robot” zipped folder in Canvas Save, compile, then run this program.
Questions Name of project? Name of class? Name of main method? Name of project? Getting Started Name of class? MyFirstRobot Name of main method? Main
Questions…. What is imported? Name of object? karel is a member of what super class? Tip: karel is a new what? What is the name of karel’s world? Where is karel declared? What is imported? Kareltherobot.*\; (this is a “package” that already contains a class named UrRobot Name of object? karel karel is a member of what super class? Tip: karel is a new what? UrRobot What is the name of karel’s world? MyFirstRobot.kwld Where is karel delivered? Street 2, Avenue 2, facing East, with 0 beepers in his bag.
Questions What are the methods that every UrRobot class member can do? Move turnOff turnLeft pickBeeper putBeeper
Questions What are the methods that every UrRobot class member can do? Move turnOff turnLeft pickBeeper putBeeper Move turnOff turnLeft pickBeeper putBeeper
Questions What are the methods that every UrRobot class member can do? Move: Moves forward one block turnOff: Turns off, then stops program turnLeft: Turns 90 degrees left pickBeeper: Gets beeper on current corner putBeeper: Puts beeper on current corner Move turnOff turnLeft pickBeeper putBeeper
Questions What can cause an UrRobot object to shut off? (and stop your program!) Move turnOff turnLeft pickBeeper putBeeper Move turnOff turnLeft pickBeeper putBeeper
Questions What can cause an UrRobot object to shut off? (and stop your program!) Move into a wall turnOff (this should be obvious) turnLeft – no problem here pickBeeper – when no beepers are there putBeeper – when karel has none in his bag Move turnOff turnLeft pickBeeper putBeeper
Error Classification 4-types lexical error (compiler catches) word not in its dictionary syntax error (compiler catches) incorrect grammar, punctuation, incorrect location of a statement execution error (run-time environment catches) can’t perform what you ask (at run-time) intent error (logic - guess who catches this one!) program terminates successfully – junk output, however