This first assignment is a collection of exercises designed to use the programming ideas and tools we have learned to date.
There will be a number of files to turn in, so please check to ensure you have completed each one.
- Trace-table document, labeled A1_trace.doc
- Debug table document, plus fixed code, labeled HmwkErrors.doc and HmwkErrors.java
- Clockwise box robot code, labeled BoxBot.java
Grading, for the trace-table and debugging exercise will be based on completeness of the exercise.
Grading for the two coding
exercises will be based on completion of the exercise, which includes creating the requested additional commands. There will also
be some points awarded for organization of code, style of code (correctly indenting, and bracketing), and commenting of code.
Comments should describe the purpose of each service / method / function that you create, as well as your approach to solving the
logic of putting those services together.
You should use the program source code tracing handout, located on the website, under the Blank Documents area, behind the link
labeled Program Trace Table, to trace through the program for this part.
The program that you'll trace for this part of the assignment
is available on the website, in the file A1_trace.java.
You should save your trace for this program in a
file named A1_trace.
If you find any errors in the provided file, you should fix any compile-time errors in a reasonable manner, and then trace the file anyway.
For any run-time (or logical/intent) errors, you should trace up to the statement which causes the robot (or program, etc) to crash,
and explain why that statement causes the robot to crash, but do not trace beyond the logical/run-time error.
Note: that it's perfectly legal to have avenue and streets that have negative numbers (i.e., the avenue immediately to the west of
avenue of 0 (zero) is avenue number -1).
Debug the program HmwkErrors.java. Be sure the program not only compiles but performs appropriately
according to the comments listed in the code.
Again, record each error and its solution in a debug table. You should put your answer to this part of the homework assignment
in a file named A2_Errors.
- Go around the Box
Given the Starting_Template.java file, you need to write the code to create the city
(as pictured below),
and then write the code to move the robot clockwise around the box.
You need to name the file that contains your solution BoxBot.java.
The robot must start the program as pictured below, go around the box clockwise, and then end the program in the same intersection that
it started in (as pictured below).
When doing this you must look for opportunities to create useful new commands (services / methods/ functions), and you must then use them.
One example might be a
"turnRight" command. You should implement at least two new commands.