Answered step by step
Verified Expert Solution
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, Wk Milestone Part FoodVendor operations
In this final part of Milestone the FoodVendor class created in Milestone 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
adminlogin
Prompt the user to input username and password.
Prompt the user to reenter username and password if the username does not exist, the user is a customer, or incorrect password.
User has a maximum of attempts to login Program will exit after failed attempts.
Return an Admin object after successful login
Ex of output from adminlogin after failed login attempts:
Please enter your username: abcdefg
Please enter password:
Admin account not found or password mismatch! Please check your username and password.
Please enter your username: gwarner
Please enter your password: zJk@rAvua
Admin account not found or password mismatch! Please check your username and password.
Please enter your username: rebradshaw
Please enter your password:
You have reached the maximum number of login attempts. Goodbye!
updateadminprofileuser
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 updateadminprofile output:
Current user profile for rebradshaw:
Phone number:
Email address: rebradshaw@mail.com
Please enter the new phone number no space or dash:
Please enter the new email address: newemail@email.com
customerlogin
Prompt the user to input username and password.
Prompt the user to reenter username and password if the username does not exist, the user is an admin user, or incorrect password.
User has a maximum of attempts to login Program will exit after failed attempts.
Return a Customer object after successful login
Ex of customerlogin output:
Please enter your username: gwarner
Please enter your password: zJk@rAvua
updatecustomerprofileuser
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 updatecustomerprofile output:
Current user profile for gwarner:
Credit card number:
Expiration date:
Billing address: Panda St Happy Town, HC
Phone number:
Email address: gwarner@mail.com
Please enter the new credit card number no space or dash:
Please enter the new expiration date MMYY:
Please enter the new billing address: Happy St Happy Town, HH
Please enter the new phone number no space or dash:
Please enter the new email address: gwarner@mail.com
createaccount
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 createaccount output:
Please enter the username of the new account: gwarner
gwarner is not available, please chosse a different username: Guest
Guest is not available, please chosse a different username: aaopp
Please enter new password:
Is this a customer account YN N
Please enter first name: Aaron
Please enter last name: Opportunity
Please enter email address: arron@opportunity.net
Please enter phone number:
Please enter employee ID: FV
deleteaccountuser
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 hisher own account.
Ex of deleteaccount output:
Please enter the username of the account to be deleted: gwarner
Account of gwarner will be removed. Are you sure YN Y
Account of gwarner removed.
Modify the main method in FoodVendor.py to test the program. See examples in the template file.
qxzqy
LAB ACTIVITY
: Wk Milestone Part FoodVendor operations
Downloadable files
FoodVendor.py
DbManager.py
Users.py
user.tsv
and
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.
# Part of Milestone
def adminloginself:
# TODO: impletement your instance method here.
def updateadminprofilmenu.tsv
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started