This page contains questions and answers about Project 4. I will update this page as more questions arrive.
- What is the role of the
The interface has a similar role as interface
SteeringWheelin Exercise 2.3.1. The
getSteeringWheel()method is expected to provide certain information, and the interface describes how it is bundled up. The user of the
getSteeringWheel()method does not need to know exactly what class implements the method, but does get to rely on the three
SteeringWheelmethods being present and returning valid information.
When I assess your
getBestLoad()method, I cannot make any assumptions about the object returned from that method except that it will conform to the
Inventoryinterface. Autolab will test your
getBestLoad()method by saving the object it returns, calling the two
Inventorymethods on that object, and seeing if they return the correct result.
- What should happen when the two array arguments do not have the same size?
This behavior is not specified, and I will not test it.
- What size of tests should we make sure run on our projects?
Make sure it runs to completion on a quite large example — Java can easily hold a 1000-by-1000 array, and a large example will let you make sure that your implementation is as efficient as it should be — note in particular that the specifications do not describe exponential behavior.
- What parameters should our recursive method have?
Remember that one of the key lessons from our discussion of recursion at the beginning of the semester is that the use of recursion in the problem description should not always be the same as the use of recursion in the solution implementation. The Fibonacci sequence was our motivation there: the simplest description of the sequence used two recursive calls, but we saw that a direct implementation would be a disaster. So our implementation was not literally the same as the description, although of course they agreed on the final value.
Although we do use a recurrence relation to define the problems, think closely about the operations which we step through in the video and in the project specification. How did that those steps proceed? We did them one array cell at a time: we completed each entry of a row in order, left-to-right, completing each row top-to-bottom. Even though the description of the problem is recursive, the specification does not require you to use any particular approach. What program structure best fits visiting each slot in an array, filling out one after the other, possibly looking back at previously filled-out entries?
See also: CS220 homepage