Sale!

Assignment #1 Good Morning, Canada!

$30.00

Category:

Description

5/5 - (2 votes)

1
CS1026 – Assignment #1
Good Morning, Canada!
Due: Monday, May 17, 11:55pm on OWL
Weight: 9%
Learning Outcomes
By completing this assignment, you will gain skills relating to:
• basic Python programming constructs;
• expressions and decisions;
• getting input from users;
• validating input;
• algorithm development and testing;
• designing test cases; and
• following program specifications.
Task
Your task is to write a complete program in Python that computes the cost of breakfast
at the Good Morning, Canada! restaurant. Your program will prompt the user for input
and validate that input before computing the results. Your program will make use of
expressions, decisions and input/output in Python. You should name your program
Assign1.py.
Functional Requirements/Specifications
1. The program will prompt the user for various pieces of information about their
desired breakfast. The required information is described below. Some of the
information is dependent on the type of breakfast being ordered. Once all of the
information has been entered, the program will compute and display the amount of
money (including tax) charged for the customer’s breakfast.
2. The customer can build a custom breakfast from the following individual food and
beverage items:
Assignment #1
CS1026 – Summer 2021
2
Item Price (dollars)
Eggs 0.99 (each)
Pancakes 1.49 (each)
French toast 1.39 (per slice)
Bacon 0.59 (per strip)
Sausage 1.39 (each link)
Home fries 1.99 (per side)
Toast 0.79 (per slice)
Coffee 1.49 (per cup)
Tea 1.29 (per bag)
Orange Juice 1.99 (per cup)
3. A customer may choose to order a combo. If the customer chooses a combo,
your program will subtract 10% off of the total price of the combo before tax.
The combos are as follows:
Combo Items Included
Egg combo Three eggs; one side of home fries; two
slices of toast; four strips of bacon; two
sausage links
Pancake combo Three pancakes; four strips of bacon;
three sausage links
French toast combo Four pieces of French toast; one side of
home fries; four strips of bacon; two
sausage links
4. The program will display the available choices in the following way:
The user will type the customer’s choice. For instance, if the customer wants a
pancake combo, the user will type, pancake combo <enter>. The program will
Assignment #1
CS1026 – Summer 2021
3
then ask for the quantity: How many pancake combos would you like? The
program continues to ask for additional menu items by re-displaying the choices.
When the customer is done ordering, the user enters q <enter>. The program then
displays the pre-tax total (i.e., subtotal), the tax, and the total with tax. The
customer can order anything that they want from the menu in any quantity that they
want. (See the examples on pages 6 and 7 if any of this is unclear.)
5. The program will compute the total cost of the order with additional taxes of 13%.
All of the costs are to be rounded to the nearest penny and displayed with a dollar
sign and two decimal positions. For example, a total cost of 13.66666 will be
displayed as 13.67. All numeric output should have two (2) decimal places (e.g.,
1.01, 0.00, etc.).
6. The program will compute the prices for the combos based on the prices of the
items that they include, and it will apply a 10% discount before tax. You are NOT
ALLOWED to pre-compute the costs of these combos and then hard code these
literal numbers in the program.
7. The program must be able to compute the total breakfast cost for an entire table of
customers. For example, three customers may be sitting at the same table, where
customer A orders the pancake combo with coffee; customer B orders two eggs,
three pieces of toast, two strips of bacon, one sausage link and a cup of tea; and
customer C orders a French toast combo, two extra strips of bacon and a coffee.
The user would enter the quantities for all of these menu items: 1 pancake
combo, 2 coffees, 2 eggs, 3 pieces of toast, 4 strips of bacon, 1 sausage link, 1 tea,
1 French toast combo.
8. The program must request user input in the same order as done in the examples
on pages 6 and 7. This is to say, the program will ask for the menu item and
then for its quantity, not the other way around.
9. Your program must accept inputs whether they contain uppercase or lowercase
characters (e.g., BiG breakfast, big breakfast and BIG BREAkfast should all
be accepted). Additionally, your program must be robust to leading and trailing
spaces (i.e., the user enters spaces incorrectly before or after the input), including
cases when multiple spaces separate words in input lines (e.g., small breakfast
and small breakfast should both be accepted). A python function that
performs this type of input formatting is provided to you:
Assignment #1
CS1026 – Summer 2021
4
10. Your program must also detect and report invalid input; that is, the input must
match one of the keywords or phrases exactly (ignoring case and spaces). When an
invalid input is detected, the program will display an error message and
prompt for the input until the user enters a correct input.
11. Your program must be robust to users entering input other than numbers when
quantities are requested. That is, you should input the string and validate that
the input is numeric. This can done using isnumeric(). So, to test whether the
value of a variable quantity is actually a number, you can do
quantity.isnumeric(). This will return True if it is a number and False otherwise.
12. Finally, a number of test cases will be run against your program. Some examples of
output and test cases can be seen in the examples on pages 6 and 7; these are
NOT comprehensive – you should create your own test cases and thoroughly
test your program.
Non-Functional Requirements/Specifications
1. Include brief comments in your code identifying yourself (i.e., include your name in
a comment at the beginning of your program), describing the program, and
describing key portions of the code.
2. Assignments are to be done individually and must be your own work. Software
may be used to detect academic dishonesty (cheating).
3. Use Python coding conventions and good programming techniques. Examples
include:
§ meaningful variable names;
§ conventions for naming variables and constants (you can use underscores or
camel case, but be consistent);
Assignment #1
CS1026 – Summer 2021
5
§ use of constants, where appropriate;
§ readability; and
§ indentation.
4. The name of the file you submit MUST be Assign1.py. You will attach the
Assign1.py file in OWL. DO NOT compress/zip it. DO NOT just enter code into
the text submission area on OWL.
5. Make sure to use Python 3.9 as the interpreter; failure to do so may result in the
testing program failing.
Marking the Assignment
The TAs will be looking at the following things when grading your assignment:
1. Does the program behave according to the specifications found in the assignment
document?
2. Does the program handle both valid and invalid input properly?
3. Is the output according to specifications (e.g., does it show a subtotal, the tax and
the final amount)? Is the calculated output correct?
4. Does the program follow the instructions for both input and output?
5. Does the submission meet the non-functional requirements (e.g., proper naming
conventions, readability, proper file name, comments, etc.)?
The TAs will also be checking to ensure that things were not hardcoded and that your
program actually uses the techniques learned in this course.
Assignment #1
CS1026 – Summer 2021
6
Examples
A Basic Order
A Custom Breakfast
Assignment #1
CS1026 – Summer 2021
7
An Order Error
A Quantity Error