CS 1410-20 Lab 8
(This lab is a Java-ized variant of lab 2.
If it’s too easy, work on the homework instead. If you’re already
done with the homework, try HW 8 in Java.)
- Choose a representation for Toast:
- kind of bread: white or wheat
- toastedness, on a scale of 0 to 10
- Implement a isYummy method for Toast. Toast is yummy when
it’s white bread toasted to a level between 6 and 8 inclusive.
- Choose a representation for Bagels:
- whether the bagel is sliced
- whether the bagel has cream cheese
- toastedness, on a scale of 0 to 10
- Implement isYummy for Bagels (specified however you like—examples should clarify).
- Define a bread datatype, which can be toast or a bagel, as IBread.
- Declare isYummy so that it works on any IBread.
- Implement a toast method on IBread. Teating bread
returns bread whose toastedness is greater by 1—unless it is already 10.
Last update: Wednesday, November 3rd, 2010mflatt@cs.utah.edu |