This page lists the milestone requirements for Milestone 1 of the CC 410 Restaurant Project. Read the requirements carefully and discuss any questions with the instructors or TAs.
Purpose
The CC 410 Restaurant Project project for this semester is centered around building a point of sale (POS) system for a fictional restaurant named That’s a Wrap, offering wraps of all shapes and sizes to celebrate our favorite movies.
This first milestone involves building the classes that represent items on the restaurant’s menu. In a traditional Model-View-Controller software design pattern, these classes would make up the core of the model. This content should be mostly review of concepts learned in prior CC courses with the addition of enumerations (enums). It should not be particularly difficult, but it may be repetitive and time consuming.
Specifically, we’ll focus primarily on data encapsulation by storing attributes about each menu item in the class. We’ll also learn how to combine state and behavior by modifying the string representation of the object based on the current state, or the combined values stored in the attributes.
In future milestones, we’ll focus on adding inheritance to simplify the code and structure in these classes. We’ll also add proper unit tests and documentation to these classes. For now, our only focus is on building the classes themselves.
General Requirements
The first couple of milestones only require a subset of the general requirements introduced in the “Hello Real World” project. Read this section carefully to see what is required for this particular milestone.
This milestone must follow these professional coding standards:
- All code must be object-oriented.
- All executable code must be within a class
- Python package files such as
__init__.py
and__main__.py
are exempt.
- Python package files such as
- Classes must be organized into packages based on common usage.
- All executable code must be within a class
- This project must include automation for compilation and execution.
- Java: Use Gradle with the
application
plugin. The project should compile without errors. You may include a main class in a separate package for testing purposes only. - Python: Use tox configured to use Python 3.9 and a requirements file to install libraries. You may include a main class in a separate package for testing purposes only.
- Java: Use Gradle with the
- All code must properly compile or be interpreted.
- Java: It must compile using Gradle.
- Python: It must be interpreted using Python 3.9. Where specified, type hints should be included in the code, and all code should pass a strict Mypy type check.
- Submissions to Canvas should be tagged GitHub releases that are numbered according to Semantic Versioning.
Assignment Requirements
This milestone should include the following features:
- Wrap classes - 5
- Declared in the
thatsawrap.data.wraps
package
- Declared in the
- Side classes - 3
- Declared in the
thatsawrap.data.sides
package
- Declared in the
- Drink classes - 3
- Declared in the
thatsawrap.data.drinks
package
- Declared in the
- Enumeration classes - 3
- Declared in the
thatsawrap.data.enums
package
- Declared in the
See the That’s a Wrap Menu section below for descriptions of what each class should contain.
Python - these files should include complete type annotations and achieve a low imprecision percentage in Mypy using strict type checking.
In my testing, the only imprecision in type checking should be the first line of the __eq__
method since it must accept an imprecise object
type until the isinstance()
method call. It will also mark the @property.setter
annotations, but they don’t count toward the imprecision total and can be ignored. The total imprecision should be less than 5% overall, and will probably be less than 2% in most cases. -Russ
Time Requirements
Completing this project is estimated to require 3-8 hours.
In my testing, this milestone requires around 1000-1500 lines of pure code without documentation, or around 2000-2500 lines including documentation comments that will be included as part of milestone 2. Much of the code can be carefully copy-pasted between files with similar attributes. My best suggestion is to do the enumerations first, then pick one of the complex wraps and start there. Once you have the wraps all working, the sides and drinks are pretty easy and use much of the same structure. -Russ
Grading Rubric
This assignment will be graded based on the rubric below:
- Wrap classes - 40%
- Side classes - 20%
- Drink classes - 30%
- Enumeration classes - 10%
The following deductions apply:
- Any portion of the project which will not compile (Java), pass a strict type check (Python), or execute properly will be given a grade of 0.
- Any portion of the project which does not meet the general requirements listed above will have a commensurate amount of points deducted.
This is not an exhaustive list of possible deductions. The instructors will strive to provide reasonable and fair grading, but we can’t predict all possible defects. It is up to the student to ensure that the project is complete and correct before submission.
As part of the grading of all assignments in this course, I will be doing a deep dive into a few classes in your code. This will include leaving detailed comments on code style and format in GitHub. I will usually choose various classes to review at random, and any issues found in that class will be verified in other classes of the same type. - Russ
Submission
Submit this assignment by creating a release on GitHub and uploading the release URL to the assignment on Canvas. You should not submit this Codio project or mark it as complete in Codio, in case you need to come back to it and make changes later.
That’s a Wrap Menu
our motto: be a star - wrap things your way!
Each attribute described below should be implemented as a private variable within the class. Most attributes will also include a getter method, and sometimes a setter method, following this naming scheme (using Price as an example):
- Java - The private
price
attribute would have agetPrice
getter andsetPrice
setter method. - Python - The private
__price
attribute would have a getter and setter namedprice
implemented as a Python Property.
Wraps
Each wrap should be stored in an appropriately named class in the thatsawrap.data.wraps
package. Each wrap should include an attribute for the following data:
- Shell - a
Shell
value (see below). It should have a getter and setter method. - Addins - a Java HashSet or a Python set of
Addin
values (see below).- This attribute should have a getter method that returns a shallow copy of the set to prevent external modification. See HashSet’s Copy Constructor (Java) or set.copy (Python).
- This attribute should also have methods for Add Addin and Remove Addin to modify the list of condiments.
In addition, each wrap should have the ability to return the following data through an appropriate getter method. The data may be stored as attributes or hard coded directly into the method.
- Price - a Java
double
or Pythonfloat
value representing the base price of the item plus any upcharge associated with the chosen Shell value. - Calories - an
int
value representing the number of calories associated with the item. - Instructions - a Java LinkedList of
String
values or a Python list ofstr
values.- If stored as an attribute, it should return a shallow copy of the list to prevent external modification. See LinkedList’s Copy Constructor (Java) or list.copy (Python).
Unfortunately, the Java clone()
methods can cause an unchecked cast exception when used on Java Collections classes with generics. See this StackOverflow question for a discussion of how to get around that using a copy constructor.
Each wrap class should also override the default string representation method (toString()
in Java or __str__()
in Python) and return a string that properly describes the wrap. The string should be formatted as “{wrap name} in a {shell} Shell”, such as “The Godfather in a Stromboli Shell”.
It should also override the default equality method (equals()
in Java or __eq__()
in Python). Two items should be considered equal only if the values of all attributes are equal.
Each wrap description will include a list of ingredients included on the wrap. Those ingredients should be represented using Boolean attributes that are set to true
by default, with appropriate getter and setter methods. Changing any of these to false
will cause a “Hold {ingredient}” message, such as “Hold Pepperoni”, to be added to the Instructions list. Likewise, changing it back to true
will remove the appropriate message. If all ingredients are at their default values, the Instructions list should be empty.
Each wrap will be served in a particular Default Shell, and will include a default set of Addins. Those attributes should be populated appropriately in the constructor for the wrap. Changes to the Shell and Addins attributes will not affect the Instructions attribute at this time (we’ll add that later).
The number of Calories for a wrap will remain constant, regardless of other attributes (we’ll just pretend that changing the wrap doesn’t change the number of calories).
The Price for a wrap will change based on the value selected for the Shell. Each wrap will have a base price listed for the Default Shell option. Other shells include an associated upcharge or discount, which must be adjusted.
This means that the prices shown on the menu already include the upcharge for the given default shell. You may want to calculate and store a base price for the item by removing the upcharge from the menu price.
The Godfather (Italian Stromboli)
this wrap will make your taste buds an offer they can’t refuse
thatsawrap.data.wraps.Godfather
- The price is $9.65 and it is 1268 calories. Served in a Stromboli Shell. Ingredients: Pepperoni, Sausage, Marinara and Cheese. Addins: Peppers and Onions.
The Wizard of Oz (Spinach Greens)
an emerald city of flavors - truly a wrap of a different color
thatsawrap.data.wraps.Wizard
- The price is $10.35 and it is 1085 calories. Served in a Spinach Shell. Ingredients: Chicken, Spinach, Cheese. Addins: Tomatoes and Dressing.
Some Like It Hot (Buffalo Chicken)
a hot and spicy classic
thatsawrap.data.wraps.SomeLike
- The price is $11.45 and it is 1370 calories. Served in a Whole Grain Shell. Ingredients: Chicken, Cheese. Addins: Onions, Peppers and Buffalo Sauce.
West Side Story (Corned Beef)
a specialty from the city so nice they named it twice
thatsawrap.data.wraps.WestSide
- The price is $8.75 and it is 1240 calories. Served in a Whole Grain Shell. Ingredients: Corned Beef, Cabbage and Cheese. Addins: Onions, Pickles and Mustard.
Spartacus (Everything)
a massive wrap that can feed even the hungriest warrior
thatsawrap.data.wraps.Spartacus
- The price is $16.55 and it is 1874 calories. Served in a Spinach Shell. Ingredients: Pepperoni, Sausage, Chicken, Corned Beef and Cheese. Addins: Peppers, Tomatoes, Onions, Pickles, Buffalo Sauce and Dressing.
Sides
Each side should be stored in an appropriately named class in the thatsawrap.data.sides
package. Each side should include an attribute for the following data:
- Size - a
Size
value (see below). It should have a getter and setter method.
In addition, each side should have the ability to return the following data through an appropriate getter method. The data may be stored as attributes or hard coded directly into the method.
- Price - a Java
double
or Pythonfloat
value. - Calories - an
int
value.
Each side class should also override the default string representation method (toString()
in Java or __str__()
in Python) and return a string that properly describes the side. The string should be formatted as “{size} {side name}”, such as “Indie Yankee Doodle Dandy”.
It should also override the default equality method (equals()
in Java or __eq__()
in Python). Two items should be considered equal only if the values of all attributes are equal.
Each side description will include a Price and number of Calories for each Size. The sides will have a default size of Indie
.
Yankee Doodle Dandy (Mac & Cheese)
stuck a feather in his cap and called it macaroni
thatsawrap.data.sides.Yankee
- Indie: $2.25 and 400 calories. Studio: $3.95 and 650 calories. Blockbuster: $6.25 and 875 calories.
The French Connection (Fries)
fried potatoes good enough to keep for yourself
thatsawrap.data.sides.French
- Indie: $2.75 and 550 calories. Studio: $4.85 and 700 calories. Blockbuster: $5.25 and 950 calories.
Snow White (Apple Slices)
guaranteed not to be poisoned or your money back
thatsawrap.data.sides.SnowWhite
- Indie: $1.50 and 225 calories. Studio: $2.25 and 350 calories. Blockbuster: $3.00 and 475 calories.
Drinks
Each drink should be stored in an appropriately named class in the thatsawrap.data.drinks
package. Each drink should include an attribute for the following data:
- Size - a
Size
value (see below). It should have a getter and setter method.
In addition, each drink should have the ability to return the following data through an appropriate getter method. The data may be stored as attributes or hard coded directly into the method.
- Price - a Java
double
or Pythonfloat
value. - Calories - an
int
value. It should have a getter method. - Instructions - a Java LinkedList of
String
values or a Python list ofstr
values.- If stored as an attribute, it should return a shallow copy of the list to prevent external modification. See LinkedList’s Copy Constructor (Java) or list.copy (Python).
Each drink class should also override the default string representation method (toString()
in Java or __str__()
in Python) and return a string that properly describes the drink. The string should be formatted as “{size} {drink name}”, such as “Indie Forrest Gump”.
It should also override the default equality method (equals()
in Java or __eq__()
in Python). Two items should be considered equal only if the values of all attributes are equal.
Each drink description may include a list of flavors that may be added. Those flavors should be represented using Boolean attributes that are set to false
by default, with appropriate getter and setter methods. Changing any of these to true
will cause a “Add {flavor}” message, such as “Add Cherry”, to be added to the Instructions list. Likewise, changing it back to false
will remove the appropriate message.
In addition, drinks may specify default flavors that should be represented using Boolean attributes that are set to true
by default, with appropriate getter and setter methods. Changing any of these to false
will cause a “Hold {flavor}” message, such as “Hold Coconut”, to be added to the Instructions list. Likewise, changing it back to true
will remove the appropriate message.
If all flavors are at their default values, the Instructions list should be empty.
Each side description will include a Price and number of Calories for each Size. The sides will have a default size of Indie
. Changes to the Size attribute will not affect the Instructions attribute.
Forrest Gump (Chocolate Shake)
you never know what you are going to get
thatsawrap.data.drinks.Forrest
- Flavors: Chocolate (default), Vanilla, Caramel and Coffee. Indie: $5.25 and 980 calories. Studio: $7.50 and 1365 calories. Blockbuster: $9.00 and 1875 calories.
Singin’ in the Rain (Soda Fountain)
comes with a little umbrella, but you have to provide the song
thatsawrap.data.drinks.Singin
- Flavors: Cherry (default), Strawberry, Cola and Grape. Indie: $2.75 and 360 calories. Studio: $3.25 and 400 calories. Blockbuster: $4.00 and 550 calories.
Rocky (Protein Smoothie)
eye of the tiger not included
thatsawrap.data.drinks.Rocky
- Flavors: Strawberry (default), Banana, Peach and Mango. Indie: $5.85 and 665 calories. Studio: $7.95 and 825 calories. Blockbuster: $9.45 and 1060 calories.
Enumerations
Each enumeration should be stored in an appropriately named class in the thatsawrap.data.enums
package. Each enumeration class should also override the default string representation method (toString()
in Java or __str__()
in Python) and return a string that properly describes the item. Python developers may also wish to override the __repr__()
method to return this value as well.
Shell
an excellent setting for a delicious meal
thatsawrap.data.enums.Shell
- Whole Grain (add $0.75), Spinach (add $1.00) or Stromboli (add $1.50)
It is possible to create an enumeration that also stores additional data associated with each value, and then access that data through the enum value. You may be able to use this to simplify handling the upcharge for each shell. Below are links to some sample code from later in this course that shows how to create such an enum and use that data.
Size
options to fit any budget
thatsawrap.data.enums.Size
- Indie (Small), Studio (Medium), Blockbuster (Large)
Addins
the extras aren’t just in the background
thatsawrap.data.enums.Addins
- Peppers, Onions, Tomatoes, Pickles, Dressing, Buffalo Sauce, Mustard
Special thanks to friends and family for inspiration and menu suggestions!