Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using Python, 9 . 1 Wk 4 Milestone 2 ( Part 1 - User objects ) Instructor note: STOP! This chapter [ Wk 4 (

using Python, 9.1 Wk 4 Milestone 2(Part1- User objects)
Instructor note:
STOP!
This chapter [Wk 4(Python)- Project Programming Milestone 2(User objects)] starting with section 9.1 Wk 4 Milestone 2(Part1- User objects) is for students completing the Python path of this capstone project.
If you are following the Java path for the capstone project, please navigate back to Blackboard and find the link to Wk 4(Java)- Project Programming Milestone 2(User objects). You can also navigate within the zyBook to Chapter 10, section 10.1 to complete your graded work for week 4.
Vendor truck ordering application is a capstone project that allows a food truck company to maintain a food and user database as well as enable customers to place orders.
This project is divided into 3 milestones: 1) Database setup, 2) User object implementations with database access, and 3) Final system integration.
Milestone 2 consists of 3 labs. In this lab, three user classes are defined: a User base class, an Admin class that extends User, and a Customer class that extends User.
Follow the specifications listed below to complete Users.py.
User is the base class for Admin and Customer classes with the following specifications:
Attributes
user_name (string type)- username of user
account (string type)- account type of user (admin or customer)
first_name (string type)- first name of user
last_name (string type)- last name of user
email (string type)- email address of user
phone_num (string type)- phone number of user
password (string type)- password of user
Instance method
__init__(user_name, account, first_name, last_name, email, phone_num, password)
An overloaded constructor that instantiates a User object with the parameters.
Admin is a class that extends User class. Admin objects are used to describe users with admin account type and has the following specifications:
Attributes
employ_Id (string type)- employee ID of admin user
Instance methods
__init__(user_name, account, first_name, last_name, email, phone_num, password, id)
An overloaded constructor that instantiates a Admin object with the parameters.
__str__()
Return a string representation of Admin object.
Ex: for an Admin object with user_name, first_name, last_name, and employ_Id, the __str__() method returns
first_name last_name: user_name, Employee ID: employ_Id
Customer is a class that extends User class. Customer objects are used to describe users with customer account type and has the following specifications:
Attributes
card_num (string type)- credit card number of the customer
card_date (string type)- expiration date of credit card
address (string type)- billing address of the customer
points (int type)- reward points the customer has accumulated
history (int type)- receipt number of the customer's last order
Instance methods
__init__(user_name, account, first_name, last_name , email, phone_num, password, card_num, card_date, address, points, history)
An overloaded constructor that instantiates a Customer object with the parameters.
Set user_name to "Guest" and other attributes to "" or 0 as default values if no parameter is entered.
__str__()
Return a string representation of Admin object.
Ex: for a Customer object with user_name, first_name, last_name, and points, the __str__() method returns
first_name last_name: user_name, Rewards: points
This lab does not use DbManager.py; therefore do not use the FoodVendar.py from Milestone 1. Modify the main method in FoodVendor.py provided in this lab to test the new user classes. See examples in the template file.
534780.3348916.qx3zqy7
LAB ACTIVITY
9.1.1: Wk 4 Milestone 2(Part1- User objects)
0/5
Downloadable files
FoodVendor.py
and
from Users import User, Admin, Customer
if __name__=='__main__':
# Part 1 of Milestone 2
# Test cases
person1= User("gwarner653", "customer", "Gwion", "Warner", "gwarner@mail.com", "1640245578","zJk@rAvu4a")
print('Account type: {}'.format(person1.account))
print('First name last name: {}{}'.format(person1.first_name, person1.last_name))
print('Email address: {}'.format(person1.email))
print('Phone number: {}'.format(person1.phone_num))
print('Password: {}'.format(person1.password))
person2= Customer()
print('user_name: {}'.format(person2.user_name))
print('First name last name: {}{}{}'.format(person2.first_name, person2.last_name, person2.history))Users.py

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions