Question: Wk 4 Milestone 2 ( Part 2 - Database access with users ) In this lab, the DbManager class created in Milestone 1 is extended
Wk Milestone Part Database access with users In this lab, the DbManager class created in Milestone is extended to include new functionalities associated with the new user classes. You can use your Users.py from Part of Milestone DbManager.py and FoodVendor.py from Milestone to complete this lab. Alternatively, copy and paste all the attributes and instance methods created in your recent submissions to the new template files provided here.
To include the new functionalities, DbManager.py has the following extra specifications:
Instance methods
updateadminuser
Update the database with the phone number and email address of parameter user.
getadminusername
Return an Admin user that is in the database with username equals to the parameter. If the user is not found, return an Admin user with all attributes
updatecustomeruser
Update the database with the credit card number, expiration date, billing address, phone number, and email address of parameter user.
getcustomerusername
Return a customer that is in the database with username equals to the parameter. If the user is not found, return a customer with all attributes to or
There is no new specification for FoodVendor.py; however, modify the main method in the FoodVendor.py you have submitted for Milestone to test the program. See examples in the template file. import sqlite os
from sqlite import Error
from os import path
from DbManager import DbManager
from Users import User, Admin, Customer
class FoodVendor:
# TODO: copy and paste instance method initialize created from Part of Milestone here.
if namemain:
vendor FoodVendor
vendor.initialize
# Test cases
# Test getcustomer
printTest getcustomer with username from database'
customeruser vendor.dbgetcustomergwarner;
printcustomeruser: formatcustomeruser
# Test getadmin
printTest getadmin with username from database'
adminuser vendor.dbgetadminrebradshaw;
printadminuser: formatadminuser
# TODO: test other member methods of DbManager
vendor.dbdisconnect import csv sqlite os
from sqlite import Error
from os import path
from Users import User, Admin, Customer
class DbManager:
A class that manages the database.
#TODO: copy and paste all the instance method definitions created from Milestone here.
# Part of Milestone
def updateadminself user:
# TODO: impletement your instance method here.
def getadminself username:
# TODO: impletement your instance method here.
def updatecustomerself user:
# TODO: impletement your instance method here.
def getcustomerself username:
# TODO: impletement your instance method here. # TODO: Copy and paste your User class from Part of Milestone here.
# TODO: Copy and paste your Admin class from Part of Milestone here.
# TODO: Copy and paste your Customer class from Part of Milestone here.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
