Question: Wk 4 Milestone 2 ( Part 2 - Database access with users ) In this lab, the DbManager class created in Milestone 1 is extended

Wk 4 Milestone 2(Part2- Database access with users) In this lab, the DbManager class created in Milestone 1 is extended to include new functionalities associated with the new user classes. You can use your Users.py, from Part1 of Milestone 2, DbManager.py and FoodVendor.py from Milestone 1 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
update_admin(user)
Update the database with the phone number and email address of parameter user.
get_admin(user_name)
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 ="".
update_customer(user)
Update the database with the credit card number, expiration date, billing address, phone number, and email address of parameter user.
get_customer(user_name)
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 0.
There is no new specification for FoodVendor.py; however, modify the main method in the FoodVendor.py you have submitted for Milestone 1 to test the program. See examples in the template file. import sqlite3, os
from sqlite3 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 1 of Milestone 1 here.
if __name__=='__main__':
vendor = FoodVendor()
vendor.initialize()
# Test cases
# Test get_customer()
print('Test get_customer() with username from database')
customer_user = vendor.db.get_customer("gwarner653");
print('customer_user: {}'.format(customer_user))
# Test get_admin()
print('Test get_admin() with username from database')
admin_user = vendor.db.get_admin("rebradshaw835");
print('admin_user: {}'.format(admin_user))
# TODO: test other member methods of DbManager
vendor.db.disconnect() import csv, sqlite3, os
from sqlite3 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 1 here.
# Part 2 of Milestone 2
def update_admin(self, user):
# TODO: impletement your instance method here.
def get_admin(self, user_name):
# TODO: impletement your instance method here.
def update_customer(self, user):
# TODO: impletement your instance method here.
def get_customer(self, user_name):
# TODO: impletement your instance method here. # TODO: Copy and paste your User class from Part 1 of Milestone 2 here.
# TODO: Copy and paste your Admin class from Part 1 of Milestone 2 here.
# TODO: Copy and paste your Customer class from Part 1 of Milestone 2 here.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!