Download presentation
Presentation is loading. Please wait.
1
Karel J Robot
2
“Meet Karel J Robot” zipped folder in Canvas
Save, compile, then run this program.
3
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
4
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.
5
Questions What are the methods that every UrRobot class member can do?
Move turnOff turnLeft pickBeeper putBeeper
6
Questions What are the methods that every UrRobot class member can do?
Move turnOff turnLeft pickBeeper putBeeper Move turnOff turnLeft pickBeeper putBeeper
7
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
8
Questions What can cause an UrRobot object to shut off? (and stop your program!) Move turnOff turnLeft pickBeeper putBeeper Move turnOff turnLeft pickBeeper putBeeper
9
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
10
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.