Student View

icon picker
L1: Pricing

Your uncle & aunt opened a coffee shop and want you to help them write a piece of software that can accurately and quickly calculate the price of any cup of coffee. You’re very busy but still want to help so you will try to spend the minimum amount of time while still doing a great job. With that in mind, let’s start by writing some functions that can calculate the price given the following requirements.


1 person exercise
For each requirement below, please implement 1 function, and submit all the functions implemented
Each requirement is in additional to or replacing existing requirements
Provide an outline document for the approach, design choice, the implementation and lessons learned
Students are expected to present the outline and demo the solution to other students and coaches
Students will be graded based on the
evaluation criteria


Implement function calculatePrice1 to calculate the price of a coffee order based on the following parameters:
Drink type: hot, cold, or blended
Size: S, M, or L
Whipped cream topping: with or without
Availability of L size: only for cold and blended drinks
Base price: $2 for a small hot drink without cream
Price adjustments:
$.5 for M size, $1 for L size
$1 for blended drinks
$.5 for whipped cream topping
Implement function calculatePrice2 that
add XL size which will cost $1.5 additionally
Add milk tea drink type with a base price of $2.25
Add milk options where whole milk or almond milk with
almond cost additional 50c
Add function calculatePrice3 which allow customization options for chocolate sauce, which can only be added to hot drinks and has the following pricing:
The first 2 pumps are free
$0.5 for each extra pump
Maximum of 6 pumps
Add function calculatePrice4 that can handle the customization options for breakfast items, which includes sandwiches and bagels with the following specifications:
Both has base price of $3
Sandwiches can be egg or turkey for $1 additionally
Bagels can have butter or cream cheese toppings for 50c additionally
There is no size for food items
Add function calculatePrice5 that calculate a list of item instead of one item at a time.
Please add tax of 7.25% for the total price
Please also return the price break down for each item

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
) instead.