Ice10 Temporary and Parameter Variables

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 11.1: Finding Errors: Temporary Variables

Download the file the ICE_06_Errors_Temp.java file, and find all the compile-time (syntax) errors and logical (intent) errors that prevent the program from running.

You should keep a list of the errors using a Program Debug Table (which you also download from the website). You are not fixing the errors at this point, your just listing them with the Program Debug Table.

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

ICE ICE 11.2: Fixing Errors: Temporary Variables

Using the same ICE_06_Errors_Temp.java file, fix all the errors so you can get the program up and running.

If necessary, you may need to move the Walls around to do that, as they may be in the way

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

ICE ICE 11.3: Writing Code: Parameters

Make a copy the ICE_06_Errors_Temp.java file and rename it ICE_06_Errors_Param.java (remembering to rename the public class to ICE_06_Errors_Param as well or your program will not work).

Rework the code so instead of using local vartiables you will be using parameter variables.

Use the same number (5) that you used in the ICE_06_Errors_Temp.java file to confirm that the program works.

Now experiment with different numbers, but do not move your walls. If your robot does run into a wall and crash, what snippet of code might you add to prevent this from happening?

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

ICE ICE 11.4: Updating Code: Parameters

If your robot does crash into a wall, add a snippet (or snippets) of code to prevent the robot from crashing.

If you find yourself spending too much time on this one, then simply remove the walls from your code.

HINTHINT: You may want to use other java files from the past as a reference

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

ICE ICE 11.5: Adding User Input: Parameters

Make a copy of your ICE_06_Errors_Param.java file and rename it ICE_06_Errors_User.java (remember to rename the public class to ICE_06_Errors_User as well).

Instead of "hard-coding" the integer (5) or some other number in the parameter parenthesis, add the necessary code that would allow the user to enter this number.

Make sure to add import java.util.*; at the top of the file, to include an error checking that an integer is being entered and not some other character, and the code that would remove any remaining data from the memory space.

HINTHINT: You may want to look at the Basic_Keyboard_IO.java file from Lecture 8 to use as a reference.

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

ICE ICE 11.6: Adding Code to Move Around Walls (Optional)

Add a feature to your code that would have the robot correctly circumnavigate an obstacle (a Wall) then continue moving in the direction as commanded once it got around it (the Robot should end up at its same end point as if there had been no wall(s) to begin with).

HINT NOTE: Robot should always end up at original coordinates regardless of number & placement of the walls, whether NORTH/SOUTH or EAST/WEST, but only if NO walls are placed side-by-side (does not need to work if two or more Walls are erected next to one another side by side).

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