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.
The CC 410 Restaurant Project project for this semester is centered around building a point of sale (POS) system for a fictional restaurant named Starfleet Subs, based in the Star Trek universe.
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.
Tip
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.
Warning
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:
__init__.py
and __main__.py
are exempt.application
plugin. The project should compile without errors. You may include a main class in a separate package for testing purposes only.The following requirements ARE NOT enforced for this milestone, but will be enforced in later milestones that use the same code. We will focus on learning to meet each of these requirements in future modules. However, you are welcome to “plan ahead” by minimizing the number of style errors in your code and adding some basic documentation where desired.
Tip
You can make things easier on yourself by following proper naming standards for your language of choice, even though we aren’t enforcing a style guide for this milestone.
ClassName
, methods and attributes start with lowercase like methodName
. See the Google Style Guide.method_name
, with the exception of classes, which are named in CamelCase starting with an uppercase letter like ClassName
. See the Google Style Guide.It is easier to get this correct from the start, then having to refactor your code later. Of course, major refactoring is also a good lesson that guarantees you’ll get it right in the future!
flake8-docstrings
and pep8-naming
plugins. Code should conform to PEP 8 style with Google style docstrings.This milestone should include the following features:
starfleetsubs.data.entrees
packagestarfleetsubs.data.sides
packagestarfleetsubs.data.drinks
packagestarfleetsubs.data.enums
packageSee the Starfleet Subs 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.
Tip
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
Completing this project is estimated to require 3-8 hours.
Tip
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 entrées like TheRiker
and start there. Once you have the entrées all working, the sides and drinks are pretty easy and use much of the same structure. -Russ
This assignment will be graded based on the rubric below:
The following deductions apply:
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.
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.
our motto: to boldly eat a sandwich where no sandwich has been eaten before
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):
price
attribute would have a getPrice
getter and setPrice
setter method.__price
attribute would have a getter and setter named price
implemented as a Python Property.Each entrée should be stored in an appropriately named class in the starfleetsubs.data.entrees
package. Each entrée should include an attribute for the following data:
Bread
value (see below). It should have a getter and setter method.Condiment
values (see below).
In addition, each entrée 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.
double
or Python float
value.int
value. It should have a getter method.String
values or a Python list of str
values.
Info
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 entrée class should also override the default string representation method (toString()
in Java or __str__()
in Python) and return a string that properly describes the entrée. The string should be formatted as “{sandwich name} on {bread}”, such as “The Kirk on White Bread”.
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 entrée description will include a list of ingredients included on the sandwich. 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 Ham”, to be added to the Special Instructions list. Likewise, changing it back to true
will remove the appropriate message. If all ingredients are at their default values, the Special Instructions list should be empty.
Likewise, each entrée description will include a Price, number of Calories, a default value for Bread and a default set of Condiments. Those attributes should be populated appropriately in the constructor for the entrée. Changes to the Bread and Condiments attributes will not affect the Special Instructions attribute. Likewise, the Price and number of Calories will remain constant, regardless of other attributes.
just like the man himself, this sandwich “hams” it up and is super “cheesy”
starfleetsubs.data.entrees.TheKirk
- The price is $6.35 and it is 650 calories. Served on White Bread with Ham and Cheese. Comes with Lettuce, Tomato, and Mayo.
a heartier sandwich, with turkey and bacon to keep your ship in top shape
starfleetsubs.data.entrees.TheScotty
- The price is $7.65 and it is 800 calories. Served on Wheat Bread with Ham, Turkey, Bacon and Cheese. Comes with Lettuce, Tomato, Onion, Mustard and Mayo.
a sandwich tasty enough for any “voyager” to enjoy
starfleetsubs.data.entrees.TheJaneway
- The price is $9.35 and it is 950 calories. Served on White Bread with Ham, Pepperoni, Salami and Cheese. Comes with Lettuce, Tomato, Onion, Pickles, Peppers, and Mayo.
the ultimate judgement of humanity, a “continuum” of meats
starfleetsubs.data.entrees.TheQ
- The price is $11.25 and it is 1375 calories. Served on White Bread with Brisket, Pulled Pork, Sausage, and Bacon. Comes with Onion, Pickles, and BBQ Sauce.
a Klingon delicacy to feed a true warrior’s hunger
starfleetsubs.data.entrees.TheGagh
- The price is $8.45 and it is 1020 calories. Served on Sourdough Bread with Meatballs, Marinara and Cheese. Comes with no condiments by default.
our “number one” sandwich
starfleetsubs.data.entrees.TheRiker
- The price is $17.01 and it is 1701 calories. Served on Wheat Bread with Ham, Turkey, Pepperoni, Salami, Brisket, Pulled Pork, Bacon and Cheese. Comes with Lettuce, Tomato, Onion, Pickles, Peppers, Olives, Mayo, Mustard, and BBQ Sauce
a most logical choice
starfleetsubs.data.entrees.TheSpock
- The price is $5.50 and it is 700 calories. Served on Wheat Bread with Cheese. Comes with Lettuce, Tomato, Onion, Pickles, Peppers, Olives, and Mayo.
Each side should be stored in an appropriately named class in the starfleetsubs.data.sides
package. Each side should include an attribute for the following data:
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.
double
or Python float
value.int
value. It should have a getter method.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 “Small Data Chips”.
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 Small
. Those attributes should be populated appropriately in the constructor for the side, and should be updated if the Size attribute changes.
crispy, crunchy potato chips seeking to understand human emotions
starfleetsubs.data.sides.DataChips
- Small: $1.75 and 250 calories. Medium: $2.25 and 350 calories. Large: $3.50 and 550 calories.
a round cookie and two gherkin “nacelles” in honor of the best ship in the fleet
starfleetsubs.data.sides.Enterprise
- Small: $1.98 and 170 calories. Medium: $3.77 and 340 calories. Large: $5.55 and 510 calories.
it is “futile” to “resist” these identical square pretzel bites wrapped in foil
starfleetsubs.data.sides.Borg
- Small: $2.55 and 375 calories. Medium: $4.15 and 565 calories. Large: $6.65 and 780 calories.
these wings are the best “bones” in the galaxy
starfleetsubs.data.sides.BonesMcCoy
- Small: $3.75 and 545 calories. Medium: $5.45 and 785 calories. Large: $6.75 and 925 calories.
Each drink should be stored in an appropriately named class in the starfleetsubs.data.drinks
package. Each drink should include an attribute for the following data:
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.
double
or Python float
value.int
value. It should have a getter method.String
values or a Python list of str
values.
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 “Small Picard”.
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 ingredients it includes by default. 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 Whipped Cream”, to be added to the Special Instructions list. Likewise, changing it back to true
will remove the appropriate message.
In addition, drinks may include optional ingredients that 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 {ingredient}” message, such as “Add Ice”, to be added to the Special Instructions list. Likewise, changing it back to false
will remove the appropriate message. If all ingredients are at their default values, the Special Instructions list should be empty.
Each drink description will include a Price and number of Calories for each Size. The drinks will have a default size of Small
. Those attributes should be populated appropriately in the constructor for that class, and should be updated if the Size attribute changes. Changes to the Size attribute will not affect the Special Instructions attribute.
tea, Earl Grey, hot
starfleetsubs.data.drinks.ThePicard
- Tea served with Lemon. Can optionally add Ice. Small: $0.95 and 5 calories. Medium: $1.65 and 10 calories. Large: $2.25 and 15 calories.
the ultimate comfort drink inspired by a chocolate sundae
starfleetsubs.data.drinks.TheTroi
- Espresso served with Chocolate, Whipped Cream and a Cherry. Can optionally add Extra Espresso Shot. Small: $3.75 and 300 calories. Medium: $4.35 and 425 calories. Large: $5.25 and 600 calories.
a warrior’s drink
starfleetsubs.data.drinks.TheWorf
- Prune Juice. Can optionally add Ice. Small: $1.25 and 150 calories. Medium: $1.75 and 225 calories. Large: $2.55 and 415 calories.
a refreshing drink for a mysterious connoisseur
starfleetsubs.data.drinks.TheGuinan
- Lemonade served with Ice. Can optionally add Strawberry and/or Cherry. Small: $2.30 and 150 calories. Medium: $3.45 and 225 calories. Large: $4.65 and 395 calories.
the ultimate in hydration, direct from Altair IV
starfleetsubs.data.drinks.AltairWater
- Can optionally add Ice and/or Lemon. All sizes are $0.50 and 0 calories.
Each enumeration should be stored in an appropriately named class in the starfleetsubs.data.emnums
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.
an upper deck and a lower deck is important for any sub
starfleetsubs.data.enums.Bread
- White Bread, Wheat Bread, Sourdough Bread
options to fit any appetite
starfleetsubs.data.enums.Size
- Small, Medium, Large
don’t forget your KHAAAAAANNNNN!-diments
starfleetsubs.data.enums.Condiment
- Lettuce, Tomato, Onion, Pickles, Peppers, Olives, Mayo, Mustard, BBQ Sauce
Special thanks to Nathan, Stephen, Sarah, Kellie, Dan, Jack, Josh, Pascal, Beth, and Vince for inspiration and menu suggestions!