The actual program must still be written. As you might have expected, the file we included in the starter project doesn t contain the finished product but only the header line for the class. If you double-click on CollectNewspaperKarel.java, for example, you will see the following file appear in the editing area in the upper middle section of the Eclipse screen: Note that the comments at the top of the file many not display initially and may need to be "expanded" by clicking the small '+' sign next to the comment header line. You can open any of these files by double-clicking onģ 3 its name. There right on the screen are the Java files for each of the assignments. Opening this package reveals: Now things have gotten much more exciting. Things get more interesting when you open the (default package), which is where the code you will write this quarter will go. Clicking on the plus-sign/triangle exposes the first level of the package: At this point things look a more promising there is something about "worlds" listed there. When you do so, Eclipse will load the starter project and display its name in the Package Explorer window (on the left-hand side of the Eclipse application) like this: The small plus-sign (triangle on the Mac) to the left of the folder name indicates that you can open it to reveal its contents. (Note that if you see anĢ 2 Assignment1 folder inside another folder named Assignment1, you want to select the innermost Assignment1 folder.) Now, make sure that the check box labeled Copy projects into work space is not checked (if the box is checked, just click on it to uncheck it). button to find and highlight (click on) the Assignment1 folder, then click OK. Click on this button and then click the Browse. Find the small icon in the toolbar that looks like: This button is the Import Project button and is used to load a project folder into Eclipse so that you can work with it. Importing projects into the workspace From here, your next step is to start up Eclipse, which will bring up the Eclipse window shown on the last page of Handout #5. Move that folder to some place on your file system where you can keep track of it when you want to load the project. The unzipped contents of the ZIP file is a directory named Assignment1 that contains the project. If you don't have software to unzip/extract the archive, see the text on the assignment page to see what software you may need (for example, extraction software is usually built-in to Windows Vista/7/8 or Mac OS X). In some cases, the browser will also unzip/extract the folder automatically, assuming that you have the appropriate software for expanding files from a ZIP archive. If you go to the CS106A assignment page (go to the CS106A web site and click the Assignments link on the left-hand side of the page), you ll see a display that looks like something this: If you click on the link for Assignment1.zip, your web browser will download the starter folder. Downloading starter projects The first step in working with any Karel assignment is to download the starter project for that assignment. That way, you can ignore all the mechanical details of making new projects and focus instead on the problem-solving aspects of the assignments. Although it is not all that hard to create new Eclipse projects from scratch, it certainly reduces the complexity of assignments if we provide starter projects to get you going. 1 Mehran Sahami Handout #6 CS 106A SeptemUsing Karel with Eclipse Based on a handout by Eric Roberts Once you have downloaded a copy of Eclipse as described in Handout #5, your next task is to understand how to write Karel programs using the Eclipse framework.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |