Fall 2009 Project Assignment 14
- Date Assigned
- November 30, 2009
- Date Due
- December 4, 2009
- Submission Format
- You will submit a hard copy of all answers at the end of lecture on the assigned date (or before
the assigned date in a prior lecture or office hours to Pete or any TA). You will also submit a
soft copy of the your java class solutions. When submitting you will name the submission file:
Assignment14.java, note .java is the extension. This copy will be provided using
e-Learning Support Services and the assignment
has been linked from e-lss. In the top right hand corner of your submitted hard copy, list: your
name, your section number, the assignment number, the due date. Your hard copy submission paper
must be a printed page, not handwritten. The template structure follows in the
same manner as Assignment 01 & 02.
- Do not declare any of your classes to be public.
- Assignment
- Create a UML diagram representing the following classes and interfaces. Only a hard copy
submission is required for your diagram. Your diagram may be a printed page or handwritten
(drawn), however it must be legible. You may create two diagrams, one containing
the class relationship details and one containing the details of the classes themselves. You may
leave out any of the standard list of methods that are not required in your Java solution.
- Create the following classes and interfaces. In each class, include any of the standard list of
methods you require. If one of the standard list of methods is not required, you may leave it out.
Note, this solution builds upon Assignment 13. If you choose to use Assignment 13 as your starting
point, some of the existing solution will need to be modified in order to make the additions
required.
- The class Driver provides access to the FoodCourt.
- The class FoodCourt represents the operations of the FoodCourt. It contains an array
of type Restaurant. In the default representation of the FoodCourt, the array will contain
a Cheeburger and Subway restaurant. The class will allow the user to interact with each of
these restaurants, providing the ability to prepare meals and consume food.
- The class Restaurant contains the property name, type String, the name of the customer
for whom the meal will be prepared. The class will contain the method prepareMeal. The
method will determine the name of the customer and return a default object of type Food.
The method will not receive any parameters. The class will implement the interface
Comparable.
Comparisons will be based upon the name of the customer.
- The class Food contains the method prepareFood. The method will print to the screen
"Your food is being prepared". The method will not receive anything. The method will not
return anything. The class will have the subclasses Burger and Sub.
- Create the interface Consumable. The interface will define items that can be consumed. It
will contain the method consume
- The class Burger is a subclass of Food. Burger will contain the property pounds
representing the amount in pounds desired for the burger, the options being one quarter,
one half, and one pound. The method prepareFood will query the user for how large a burger
they would like prepared. The class will implement the interface
Comparable.
Comparisons will be based upon the pounds of the burger. The class will implement the
interface Consumable. Consumption of a burger comprises decreasing the size of the
burger by one quarter until the size of the burger is zero.
- The class Sub is a subclass of Food. Sub will contain the property isVeggie
representing whether the sub is a vegetarian sub or not. The method prepareFood will
query the user for whether or not they would like a vegetarian sub prepared.
The class will implement the interface
Comparable.
Comparisons will be based upon if the sub is vegetarian or not.
The class will implement the interface Consumable. Consumption of a sub comprises
experiencing (printing) indegestion if the sub is not vegetarian.
- The class Cheeburger is a subclass of Restaurant. The method prepareMeal will prepare the
customer a Burger.
- The class Subway is a subclass of Restaurant. The method prepareMeal will prepare the
customer a Sub.
<<<< Prev
Next >>>>