Microsoft Word - HA2_spec.docx
Homework Assignment XXXXXXXXXXDue: 3/14 11:59PM
Topics: Branching, for and while loop, Sequence, Basic I/O
Problem description: Write a python application to simulate a simple apps store. The purpose of this
assignment is to gain experience in python’s loop (while and for) structure, condition structure,
sequence and basic I/O.
Design solution: The program will have a global apps list of all apps which is provided in the template
file. Each of the item in the list contains a name of the app and its price, name and price are separated
y a colon ( : ). The program will have a menu for actions available to the customer. A customer will be
able to choose the following options from the menu:
1. display all apps: Display all the apps in the master apps list with its price information. You need to
use a for loop to iterate over the apps list, separate the name and price and display the information as
shown in sample I/O. Directly printing the list will deduct points.
2. add app to the shopping cart: Customer will only be able to add an app if the name is in the master
apps list. Once added, the name and its price need to be added to a shopping cart list, the information
- name and price - needs to be separated (as in master list) by any delimiter of your choice (like: colon,
space, dash etc). Display the shopping cart list after adding an item.
3. delete an app from cart: Customer will enter the name of the app and the program will look for the
app in the shopping cart list to be deleted from. Display the shopping cart list after deletion.
4. check out: Display the list of the apps and their individual price that are being selected by the user,
then display the total price the shopping cart. Again, you need to use a for loop to iterate over the
shopping cart list, separate the title and price and display the information as shown in sample I/O.
Directly printing the list will deduct points.
5. exit/terminate the program.
Notes:
• The customer shopping cart list should be implemented as a separate list. Any
addition/deletion of items should be done in this list. apps list should not be modified.
• The program needs to handle uppercase and lowercase letter. Customer can enter the name
that can have all small letter but the program should still be able to find the app if in the global
apps list. You can use str.lower() – converts all letters to lower case or str.upper() – converts all
letters to uppercase.
Sample I/O: A sample I/O is provided to see how the program works. You need to use formatting
function to properly display the information. Please note sample I/O is provided to clarify what to be
expected from the program. You may change the language/interface but the program needs to display
the information as shown:
*********** Welcome to mini app store ***********
Available options:
1: Display apps
2: Add apps to my cart
3: Delete an apps from cart
4: Checkout
5: Exit
Enter option: 1
******* List of apps *******
Name--Price
---------------------------------
Weather channel--$1.99
Bu
le Shooter--$0.99
Gallery Pro--$1.09
Scanner Pro--$2.99
Voice Recorder--$3.99
Peak Finder--$4.99
**********************
Available options:
1: Display apps
2: Add apps to my cart
3: Delete an apps from cart
4: Checkout
5: Exit
Enter option: 2
Enter app name to add to cart: weather channel
*********** Your Cart ***********
Name--price
Weather channel--$1.99
**********************
Available options:
1: Display apps
2: Add apps to my cart
3: Delete an apps from cart
4: Checkout
5: Exit
Enter option: 2
Enter app name to add to cart: scanner pro
*********** Your Cart ***********
Name--price
Weather channel--$1.99
Scanner Pro--$2.99
**********************
Available options:
1: Display apps
2: Add apps to my cart
3: Delete an apps from cart
4: Checkout
5: Exit
Enter option: 3
Enter app name to delete from cart: scanner pro
Scanner Pro deleted from cart
*********** Your Cart ***********
Name--price
Weather channel--$1.99
**********************
Available options:
1: Display apps
2: Add apps to my cart
3: Delete an apps from cart
4: Checkout
5: Exit
Enter option: 4
Your cart:
Weather channel--1.99
Your Total: 1.99
Available options:
1: Display apps
2: Add apps to my cart
3: Delete an apps from cart
4: Checkout
5: Exit
Enter option: 5
*********** Thanks for shopping with us ***********
Submission:
1. All submission will be via BlackBoard.
2. Acceptable resources to use for this assignment are: class resources, instructors and python
language li
ary and references.
3. The codes and pseudocode need to be written in the firstname_lastname_HA2.py file. Please
change the name and header of the file before submission.
Grading Ru
ics:
Excellent Average Needs Improving Points
Submission
Details
Both file name and file
header meet stated
spec.
Either file name is
inco
ect or file header is
missing sections/details.
Both file name and
file header are missing
or are inco
ectly
implemented.
___/2
Code readability Comments demonstrate
which line is related to
which step of
pseudocode and user-
defined names clearly
demonstrate what they
epresent.
Comments generally
demonstrate which line is
elated to which step of
pseudocode and user-
defined names generally
demonstrate what they
epresent.
Comments and
pseuducode are
unrelated and user-
defined names
provide no insight into
the referenced data.
__/3
Control structure Control structures are
implemented co
ectly.
Control structures are
generally implemented
with minor flaws.
Control structures are
significantly flawed, or
missing.
___/5
While and for
loop
Loop is implemented
co
ectly with co
ect
loop variable
initialization and
terminating condition
Loop is implemented
generally with minor
flaws in co
ect loop
variable initialization
and/or terminating
condition.
Loop is significantly
flawed, or missing.
___/10
I/O All specified standard
input and output are
implemented including
data conversion.
All specified standard
input and output are
generally implemented
with minor flaws and/or
no data conversion.
Specified standard
input and output are
not implemented and
conversion is missing.
___/5
Overall Score ___/25