| Home | Notes | Homework | Labs | Programs |
| Program 2: Trash Man |
| Goal |
|
In your second programming assignment, you will be writing another simple robot subclass to pick up trash (i.e., beepers). Your robot will start off in the "home" position (at 1st Street and 1st Avenue, facing North, with no beepers). This is the southwest corner of a rectangular room of random size. The room is "littered" with beeper piles of random sizes at random locations. Your robot's mission is to sweep the room and pick up all of the beepers, and then turn off when done. |
|
| Initializing the World |
You can start your world off this way:
World.startFromURL( "program2.php" );
This will load up a random world description. Note that there may even be one or more beepers at the home position where your robot starts. An example room layout is shown below:
![]() Click picture for a larger view |
| Requirements for your Solution |
There are several requirements your solution must follow:
Use SweepTrash as the
name for your robot task class--the class that contains
your task() method. Also, don't change the name of the
task() method or you will get compilation errors--everything
that implements RobotTask must use the method name
task().
Your SweepTrash class must also provide the following method:
public VPIRobot robot()
{
return <yourRobotVariableName>;
}
Your robot must start at 1st Street and 1st Avenue, facing North, with no beepers.
For each class you write, also write a test class. Make sure that all of the methods you provide in your classes are tested in some way. Think about what conditions you can check with assertions, either on the robot itself, or on the world containing the robot.
| Submit Your Solution |
Program submissions work just like lab submissions.
On BlueJ's main menu, click Tools->Submit.... Click on
"Browse...", double-click to open the
"CS 1705 Programs" folder, and select
Program 2. Click "OK".
Click "Submit". Click on the link provided
in the submission response in order to view the results of the
automated phase of program grading.
If no "Program 2" entry is visible on BlueJ's submission menu, then the Web-CAT Grader is not yet accepting submissions for this assignment. Wait for a message posted to the course web site that submissions are being accepted, and try again.
If any errors are indicated, you can fix them and resubmit. You may resubmit as many times as you like, up until the deadline. Be careful as the due time approaches--if you submit just over the deadline, a late penalty will be assessed.
| Home | Notes | Homework | Labs | Programs |