|
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
Due:
Sep.28 (Wed) 15:00, D2L and hardcopy.
Your submitted file should be named “hw04.rkt”, plus any .java files..
Standard instructions for all homeworks:
A team is:
- a name (non-empty string), AND
- an offense rating (real number), AND
- a defense rating (real number).
(5pts) Give a data definition (including examples of the data, and the template for any function which processes a team), as per steps 1-3 of the design recipe. Give at least three examples of a team.
(10pts)
We'll say one team is “greater” than another if its offense is
higher than the other's defense, and its defense is higher than the other's offense.
Write the function
Hints:
Imagine a friend has two different snap-shots of the game; what is the minimal information that your friend needs to tell you so that you can always properly draw/construct an image of that object on the screen.
Do NOT include information which never changes (is “invariant”) for a class. For example, if all instances of an object are always the same color, you wouldn't have a field for the color.
1Note that the stub-function, step 5e, gets replaced with the real body (step 7), so it won't be visible in what you submit. Also, you don't need to include the names of constructors/selectors; that was part of hw04a but not part of the design recipe. ↩
2 Choose one of the types above which is naturally represented as a struct/object with more than one field. (That's probably all three of those answers, though conceivably not.) ↩
3 The natural constructor is the one that just initializes each field directly from its arguments. It's totally automatic; in fact tools like Eclipse offer a menu option to auto-generate the natural constructor. Just like we did for Book.java in class. ↩
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
©2016, Ian Barland, Radford University Last modified 2016.Oct.31 (Mon) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |