Lab
1: CodeWarrier, How to Hand in Programs, Karel's World
Background:Homework 1 will introduce you to the Code-Warrier Software package that you will use to write your Karel and Java programs for 15-100. We will practice the edit / compile / run cycle of program development. Once you have sucessfully edited, compiled and executed this simple Karel program you will use the Intro-CS Assignment Dropoff form to hand in your finished programYou will then solve two more Karel problems.
Warmup Exercise to prepare for the AssignmentDownload the hw1.zip file by clicking on this link. Save the zip file to your C:\Temp directory and unzip the files. You will see two directories for hw1a and hw1b. Inside hw1a you should see the following files:
At the top of the file, you see a section of code that is enclosed by the /** */ combination. This informs the compiler that the information enclosed is not code, and can be safely ignored. In this particular section you should type you name, section, and assignment (in this case, Lab 1) The next section has a statement package kareltherobot; A package contains the files/definitions of closely related classes. A class defined in a particular package can make use of other classes defined in the package. All of our Karel programs will become part of the kereltherobot package. Notice the three lines that begin with the // special symbol. This is another instruction for the compiler, telling it to ignore everything that follows until the end of the line. Let's compile and execute this program and see what output it produces. Go to the top of the project window and select Project / Run or click the small arrow head (looks like the Play button on a VCR / DVD player) in the middle of the project window menu bar. Karel is displayed in the work of this problem. He is facing a wall, with a beeper on the opposite side of the wall. Make a small change to the programLet's make a change to our program. After the line:// insert Karel instructions here type the following two lines: Karel.turnLeft();
pay attention to capitalization and punctuation. Run the project again. Notice that Karel has moved from its starting position. Finish the taskWrite the instructions so that Karel will pick up the beeper, carry it to origin, put it down, and then move to the corner one block north of origin.Use the robot primitive instructions we discussed in lecture
Homework 1b: Due at the end of the class Open the directory for hw1b. Compile and execute this program and you will see that Karel is in his bed inside of his house. Outside there is a newpaper, symbolized by a beeper. Write the instructions that will have Karel go, pick up the newspaper, and return to his bed to read it. He must be facing the same direction at the end of the program as when it starts, because Karel's head must be on the pillow in his bed as he reads his paper.
Handing in your SolutionYour solutions should be in the form of .zip files. When we grade your solution we will unzip the folder and execute the project. If your project does not run you will lose the execution points for that lab.Your Solution zip file must contain all the files in your projects You will be shown how to zip up the files for submission.
Instructions are also in the Tutorial
document that is available
Click on this link to Submit your zip file |