Ice12-Part2 Part 2: Multiple Files

Note:  Please keep the programs that you create today, in case you have a question about your grades for the ICEs at the end of the quarter. When you're working with a partner, each person should save his-or-her own copy.

ICE Ice 13.2.1: Multiple Files: Fixing Class in Separate Files

NOTE: We will step through this initially in class

You will need to download the following three files:

Make sure they are all in the same directory/folder/area to get the program to compile properly.

First, go through the Harvester example, and figure out why the robot is crashing, and then implement easy fixes to prevent that and make sure the robot picks up ALL things in the city.

HINTHINT: Ideally, you would do this programmatically with your code, but changing the placement coordinates of the Things in the ICE_11_Harvest.txt file is an easy fix.

Example 1

Fixed

HINTINFORMATION: For those of you that are interested in the syntax for building a City using a text file, please refer to the information in the City (Scanner in) section of the Becker Library http://www.learningwithrobots.com/doc/becker/robots/City.html

When you get done with this exercise, go on to the next section. Go Next

ICE ICE 13.2.2: Multiple Files: Putting Classes in Separate Files

Download the MrRoboto.java file from LECTURE 3 and divide the methods and main into two (2) separate files.

Make sure that the whole program still compiles, and that it runs and does everything the same as in the original version.

If you are having problems with the program compiling, make sure you have import becker.robots.*; properly called atop both files and that the class names are the same as the file names.

In the methods file, change the Robot class to RobotSE and delete those new Robot methods that are no longer needed (like turnRight() and turnAround()) since they are already a part of RobotSE, then recompile and run to make sure it does everything the same as the original.

If you cannot recall which methods the RobotSE supports by default, you may want to consult the Class RobotSE in the Becker Library document as a reference.

Becker RobotSE

When you get done with this exercise, show your Instructor.