Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

what if i wanted to add the end product of this import part class Supplier: def _ _ init _ _ ( self , name

what if i wanted to add the end product of this import part
class Supplier:
def __init__(self, name):
self.name=name
self.part=[]
def add_part(self, name, price):
self.parts.append(part.Part(name,price))
def get_price(self, part):
def part_exists(self, part): to import database
import supplier
supplier_database = database.Database()
while True:
data = input("Enter supplier name, or quit to exit: ")
if data == "quit":
break
s = supplier.Supplier(data)
print("Part info should be entered in the following format: name, price")
while True:
part_info = input("Enter part info, or quit to exit: ")
if part_info == "quit":
print()
break
try:
name, price = part_info.split(",")
price = float(price)
except:
print("Error input - Part info should be entered in the following format: name, price - please try again")
continue
s.add_part(name, price)
supplier_database.add_supplier(s)
print("
Supplier database complete!
")
while True:
data = input("Please enter in a part name or quit to exit: ")
if data == "quit":
break
supplier, price = supplier_database.find_part(data)
if supplier == False:
print("Error part does not exist in database")
else:
print(f"Part {data} is available for the best price at {supplier}. Price: ${price:.2f}")
print("
Thank you for using the price database!") without modifying the code , i dont want to add impoort part under import database, import supplier that code should be unchanged

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions