NEED HLEP ON THIS IN PYTHON CODE
JUST FILED OUT THE CODE BASED ON THE COMMENT SECTION. SEND ME BACK THE CODE IN PYTHON _________________________________________________________________________________
Cart Class:
Cart is a list subclass. A Cart object contains all the apps object user purchased. It works like
a list, where each item is an apps object.
Methods: Description Parameters Return type
subtotal:
None
Returns subtotal from the Cart object.
Iterate over all the items values to obtain
subtotal (before applying tax)
None float
App Class:
App class contains three class variables to hold different types of apps per category or per
ratings pr by price. These dictionaries are: category_dict, rating_dict and price_dict.
Methods: Description Parameters Return
type
__init__()
Initialization method to initialize an app object.
Each app has following information: ID, name,
developer, description, price, rating, category.
See below for details@@. Each apps will be
added to category_dict, rating_dict and
price_dict as described above (Program
structure #2 and #3).
ID, name,
developer,
description,
price, rating,
category
None
get_X() Returns X attribute of an app, where X = ID,
name, developer, description, price, rating,
category
None string/float
@@
Attribute name Description type
id Each app has a unique identifier. This is a private
attribute
string
name Private attribute. Name of an apps. string
developer Private attribute. Developer name of an app. string
description Private attribute. Description of an app. string
price Private attribute. Price of an apps float
rating Private attribute. User rating of an apps float
category Private attribute. Category of an apps string
Graphical
_______________________________________________________________________________
CLASS.PY FILE
#your code here
#define a class Cart - a subclass of list class
#define a subtotal function
#Returns subtotal from a Cart list object
class App(object):
'''App class defines an app item
available in store. App object saved in
category_dict per category
and rating_dict per rating and price_dict per price '''
category_dict = {}
rating_dict = {}
price_dict = {}
def __init__(self, ID, name, developer, description, price, rating, review_count, category):
'''Initialization method'''
self.__id = ID
#your code here
#initialize name, developer, description, price, rating,
#review_count, category as private attribute
#populate dict by category - key = category and values = list of app objects
if self.__category in App.category_dict.keys():
#your code here
#append object to current category
else:
#your code here
#populate rating_dict and price_dict
#rating_dict key = rating value as whole number
# for example an app of 4.9 rating will be saved under key 4 and values = list of objects for
#that rating
#price_dict will be similar as rating except key will be price,
#all the apps between 1.00$-1.99 will be under key 1.00$
#your code here
#define get methods
#to return all private attributes
#process file
filename = 'Top50ShopifyApps.csv'
with open(filename) as fin:
#use csv reader to read the file info
#slip the header
#itereate over each line
#separate the ID, name, developer, description, price, rating, review_count, category
#create an object