Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python, 9 . 3 Wk 4 Milestone 2 ( Part 3 - FoodVendor operations ) In this final part of Milestone 2 , the

Using Python, 9.3 Wk 4 Milestone 2(Part3- FoodVendor operations)
In this final part of Milestone 2, the FoodVendor class created in Milestone 1 is extended to include operations between the users and the database. You can use your most recently submitted version of DbManager.py, Users.py, and FoodVendor.py to complete this lab. Alternatively, copy and paste all the attributes and instance methods created in your most recent submissions to the new template files provided here.
To include the new operations, FoodVendor.py has the following extra specifications:
Instance methods
admin_login()
Prompt the user to input username and password.
Prompt the user to re-enter username and password if the username does not exist, the user is a customer, or incorrect password.
User has a maximum of 3 attempts to login. Program will exit after 3 failed attempts.
Return an Admin object after successful login.
Ex. of output from admin_login() after 3 failed login attempts:
Please enter your username: abcdefg
Please enter password: 1234567
Admin account not found or password mismatch! Please check your username and password.
Please enter your username: gwarner653
Please enter your password: zJk@rAvu4a
Admin account not found or password mismatch! Please check your username and password.
Please enter your username: rebradshaw835
Please enter your password: 1234567
You have reached the maximum number of login attempts. Goodbye!
update_admin_profile(user)
Output current user profile: phone number and email address.
Prompt the user to input new phone number and email address.
Update user object and database.
Ex. of update_admin_profile() output:
Current user profile for rebradshaw835:
Phone number: 1310203767
Email address: rebradshaw@mail.com
Please enter the new phone number (no space or dash): 2345671234
Please enter the new email address: new_email@email.com
customer_login()
Prompt the user to input username and password.
Prompt the user to re-enter username and password if the username does not exist, the user is an admin user, or incorrect password.
User has a maximum of 3 attempts to login. Program will exit after 3 failed attempts.
Return a Customer object after successful login.
Ex. of customer_login() output:
Please enter your username: gwarner653
Please enter your password: zJk@rAvu4a
updatecustomerprofile(user)
Output current user profile: credit card number, expiration date, billing address, phone number and email address.
Prompt the user to input new credit card number, expiration date, billing address, phone number and email address.
Update user object and database.
Ex. of update_customer_profile() output:
Current user profile for gwarner653:
Credit card number: 4562581857428221
Expiration date: 0722
Billing address: 226 Panda St, Happy Town, HC 59999
Phone number: 1640245578
Email address: gwarner@mail.com
Please enter the new credit card number (no space or dash): 1111222233334444
Please enter the new expiration date (MMYY): 0525
Please enter the new billing address: 123 Happy St, Happy Town, HH 12345
Please enter the new phone number (no space or dash): 2223334444
Please enter the new email address: gwarner@mail.com
create_account()
Prompt the user to input username of the new account. Verify if the username is available.
Prompt the user to choose account type.
Prompt the user to input user profile according to account type.
Update database.
Ex. of create_account() output:
Please enter the username of the new account: gwarner653
gwarner653 is not available, please chosse a different username: Guest
Guest is not available, please chosse a different username: aaopp55699
Please enter new password: 1234567
Is this a customer account (Y/N)? N
Please enter first name: Aaron
Please enter last name: Opportunity
Please enter email address: arron@opportunity.net
Please enter phone number: 4105209630
Please enter employee ID: FV1005
delete_account(user)
Prompt the user to input username of account to be deleted.
Confirm with user about deleting account.
Update database.
Only existing account can be deleted.
A user cannot delete his/her own account.
Ex. of delete_account() output:
Please enter the username of the account to be deleted: gwarner653
Account of gwarner653 will be removed. Are you sure (Y/N)? Y
Account of gwarner653 removed.
Modify the main method in FoodVendor.py to test the program. See examples in the template file.
534780.3348916.qx3zqy7
LAB ACTIVITY
9.3.1: Wk 4 Milestone 2(Part3- FoodVendor operations)
0/5
Downloadable files
FoodVendor.py
,
DbManager.py
,
Users.py
,
user.tsv
, and
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.
# Part 3 of Milestone 2
def admin_login(self):
# TODO: impletement your instance method here.
def update_admin_profilmenu.tsv

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions