Download presentation
Presentation is loading. Please wait.
Published by Meredith Brown Modified over 6 years ago
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
1 karel_IF_part1 Conditional Statements Flavor 1: if ( ) { } For now: these are method invokations (see next slide)
Karel – Making More Complex Decisions IF / THEN / ELSE IF THEN BEGIN Instructions END ELSE BEGIN Instructions END Do these when test = False Do these when.
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
1 of 3 Karel Karel is an educational programming language for beginners, created by Richard E. Pattis (currently at Pace University, NY). Pattis used the.
Copyright, Joseph Bergin
Nested If Statements While Loops
1 karel_part4_functions.ppt Functions Functions return values or Objects. –Using a function allows the programmer to focus on other task. –Using a function.
Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,
Chapter 3 Extending the Robot Programming Language.
You ARE NOT ALLOWED To Copy Files!!!. You ARE NOT ALLOWED To Be Told What to Write in the Program.
1 Inheritance in Java Behind the scenes: new Objects from old.
CMPUT 101 Lab # 2 September 17, :00 – 16:50.
Karel the Robot -- ITERATE Problem Statement: Karel is told to “take a walk around the block!” Revise Algorithm: Define move ahead 5 streets Define turnright.
Karel The Robot In the beginning… software. Karel the Robot All robots are controlled by software Artificially intelligent robots that can “think”
Polymorphism Are there different ways to solve the Harvester problem? – Robot teams – instead of one robot to solve a problem, let’s get a team of robots.
Robot? What’s a Robot? Introducing Karel-the-Robot.
Extending the Robot Programming Language In the Robot world 1 mile = 8 blocks Suppose we want a robot to run a marathon (26+ miles)? Does our program have.
Karel JRobot Karel is an educational programming language for beginners, created by Richard E. Pattis (currently at Pace University, NY). Pattis used the.
Chapter 5 Conditionally Executing Instructions
1 karel_part5_loops Iteration (Loops) Loops repeat a set of instructions Two types of loops: –Definite loops ( for ) perform instructions explicit (known)
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.
玻璃钢生产厂家厦门玻璃钢雕塑工厂保定玻璃钢神像雕塑开封抽象玻璃钢雕塑定做南通商场玻璃钢花盆玻璃钢雕塑材料价格北京创意玻璃钢雕塑制作东莞玻璃钢卡通雕塑生产厂家池州创意玻璃钢雕塑制作太原学校玻璃钢雕塑定制祥符玻璃钢雕塑设计宣城动物玻璃钢雕塑市场济源玻璃钢卡通动物雕塑生产厂家荷叶玻璃钢雕塑定制兴宁玻璃钢花盆花器芜湖玻璃钢雕塑价位哪里有玻璃钢人物雕塑厂家玉溪玻璃钢仿铜雕塑四川装饰商场美陈销售厂家鹤壁校园玻璃钢雕塑价格玻璃钢人像雕塑有哪些公司衢州人物玻璃钢雕塑甘南动物玻璃钢雕塑设计沈阳创意玻璃钢雕塑价位云南玻璃钢蔬菜雕塑玻璃钢维纳斯雕塑湖南景观玻璃钢雕塑图片人物卡通玻璃钢雕塑哈尔滨玻璃钢雕塑中卫玻璃钢雕塑厂家商场开业的美陈香港通过《维护国家安全条例》两大学生合买彩票中奖一人不认账让美丽中国“从细节出发”19岁小伙救下5人后溺亡 多方发声单亲妈妈陷入热恋 14岁儿子报警汪小菲曝离婚始末遭遇山火的松茸之乡雅江山火三名扑火人员牺牲系谣言何赛飞追着代拍打萧美琴窜访捷克 外交部回应卫健委通报少年有偿捐血浆16次猝死手机成瘾是影响睡眠质量重要因素高校汽车撞人致3死16伤 司机系学生315晚会后胖东来又人满为患了小米汽车超级工厂正式揭幕中国拥有亿元资产的家庭达13.3万户周杰伦一审败诉网易男孩8年未见母亲被告知被遗忘许家印被限制高消费饲养员用铁锨驱打大熊猫被辞退男子被猫抓伤后确诊“猫抓病”特朗普无法缴纳4.54亿美元罚金倪萍分享减重40斤方法联合利华开始重组张家界的山上“长”满了韩国人?张立群任西安交通大学校长杨倩无缘巴黎奥运“重生之我在北大当嫡校长”黑马情侣提车了专访95后高颜值猪保姆考生莫言也上北大硕士复试名单了网友洛杉矶偶遇贾玲专家建议不必谈骨泥色变沉迷短剧的人就像掉进了杀猪盘奥巴马现身唐宁街 黑色着装引猜测七年后宇文玥被薅头发捞上岸事业单位女子向同事水杯投不明物质凯特王妃现身!外出购物视频曝光河南驻马店通报西平中学跳楼事件王树国卸任西安交大校长 师生送别恒大被罚41.75亿到底怎么缴男子被流浪猫绊倒 投喂者赔24万房客欠租失踪 房东直发愁西双版纳热带植物园回应蜉蝣大爆发钱人豪晒法院裁定实锤抄袭外国人感慨凌晨的中国很安全胖东来员工每周单休无小长假白宫:哈马斯三号人物被杀测试车高速逃费 小米:已补缴老人退休金被冒领16年 金额超20万