Multi-File Programs |
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 that the robot picks up ALL things in the city.
Second, you too can put different classes into separate files. Take a program that you’ve worked with (such as an in-class exercise), and separate the robot class into its own, separate file. Make sure that the whole program still compiles, and that it runs and does everything the same as in your original version.
Download the two starter files for the Standard version of A4 (the guessing game program). Make sure that you can compile and run the program as it is provided to you.
Next, modify the PlayGuessingGame method, in the GuessingGame file, so that it does something different. It doesn't matter what – you just want to change it, recompile it, and verify that you can re-run the program and see these new results. Having it do something like printing out a new/changed message would be a good choice.