示例#1
0
def main():
    # Create an instance of bike shop - Frisco's Bike Mart

    FriscoBikeMart = Shop('Fisco Bike\'s Mart', .2)
    FriscoBikeMart.inventory = {
        'Madone': 5,
        'Lexa': 3,
        'Silque': 5,
        'FX': 2,
        'CrossRip': 1,
        'Tandem': 1
    }

    # Create 3 customers
    lee = Customer('Yih-Yoon Lee', 200)
    chia = Customer('Chang Chia', 500)
    joseph = Customer('Joseph Tan', 10000)

    customers = [lee, chia, joseph]

    madone = Bicycle('Madone', 150, 150)
    lexa = Bicycle('Lexa', 90, 400)
    silque = Bicycle('Silque', 80, 1000)
    fx = Bicycle('FX', 70, 1500)
    crossrip = Bicycle('CrossRip', 65, 4500)
    tandem = Bicycle('Tandem', 55, 8000)

    bicycles = [madone, lexa, silque, fx, crossrip, tandem]

    FriscoBikeMart.display_inventory()

    for customer in customers:
        customer.display_bikes(FriscoBikeMart, bicycles)

    for customer in customers:
        customer.buy_bike(customer, bicycles, FriscoBikeMart)

    print '\n{0}\'s Updated Inventory:'.format(FriscoBikeMart.shop_name)
    print '*' * 40

    FriscoBikeMart.display_inventory()

    print '\n{0}\'s total profit: {1}'.format(FriscoBikeMart.shop_name,
                                              FriscoBikeMart.total_profit)
示例#2
0
Create a bicycle shop that has 6 different bicycle models in stock. The shop should charge its customers 20% over the cost of the bikes.
Create three customers. One customer has a budget of $200, the second $500, and the third $1000.
Print the name of each customer, and a list of the bikes offered by the bike shop that they can afford given their budget. Make sure you price the bikes in such a way that each customer can afford at least one.
Print the initial inventory of the bike shop for each bike it carries.
Have each of the three customers purchase a bike then print the name of the bike the customer purchased, the cost, and how much money they have left over in their bicycle fund.
After each customer has purchased their bike, the script should print out the bicycle shop's remaining inventory for each bike, and how much profit they have made selling the three bikes.
"""

from bicycles import Bicycle, BikeShop, Customers

if __name__ == '__main__':

    #Create a bicycle shop that has 6 different bicycle models in stock. The shop should charge its customers 20% over the cost of the bikes.
    
    bikes = {
        Bicycle("cheetahbike", 10, 50), Bicycle("catbike", 25, 100),
        Bicycle("dogbike", 50, 200), Bicycle("turtlebike", 75, 300),
        Bicycle("birdbike", 100, 500), Bicycle("capybike", 200, 1000)
    }
    customers = [Customers('jim', 200), Customers('oscar', 500), Customers('jan', 1000)]

    jim = Customers('jim', 200)
    oscar = Customers('oscar', 500)
    jan = Customers('jan', 1000)
    
    #instantiate the bike shop and add bikes to inventory dictionary {model: object}
    theoffice =  BikeShop('theoffice', bikes)
    
#Print the name of each customer, and a list of the bikes offered by the bike shop that they can afford given their budget. Make sure you price the bikes in such a way that each customer can afford at least one.
    for customer in customers:
        customer.affordables = theoffice.filter(customer.fund)
示例#3
0
文件: main.py 项目: betz428/bike_shop
        else:
            pass


def inventory_cost(bike_shop):
    '''
    returns the total cost of a bike shops bike inventory
    '''
    bike_shop.carrying_cost()
    print(bike_shop.inv_dict())


# Define Class instances:

bike_1 = Bicycle('Mojo HD', 19, 800.01)
bike_2 = Bicycle('Stumt Jumper', 24, 120.01)
bike_3 = Bicycle('Super Fly', 20, 805.01)
bike_4 = Bicycle('Enduro', 22, 400.01)
bike_5 = Bicycle('Singletrack', 27, 121.01)
bike_6 = Bicycle('Nomad', 23, 350.01)
lst = [bike_1, bike_2, bike_3, bike_4, bike_5, bike_6]

customer_1 = Customers('Mike', 200, [])
customer_2 = Customers('Drew', 500, [])
customer_3 = Customers('Vince', 1000, [])

bike_shop_2 = BicycleShop('Bike World',
                          [bike_1, bike_2, bike_3, bike_4, bike_5, bike_6],
                          1.20)
示例#4
0
from bicycles import Bicycle, BicycleShop, Customer

if __name__ == '__main__':
    bike1 = Bicycle()
    huffy = Bicycle("Huffy", 30)
    speedster = Bicycle("Speedster", 5)
    shwin = Bicycle("Shwin", 20)

    bike1.cost()

    bills  = BicycleShop("Robert's Bikes", [bike1, huffy, speedster, shwin, huffy, bike1])

    print(bills.inventory_cost())
    print(bills.profit_or_loss())

    james = Customer("James", 200)
    edward = Customer("Eddy", 500)
    richie = Customer("Rich", 1000)

    customers = [james, edward, richie]

    print("-----------")
    customer_list = list(map((lambda customer: customer.name), customers)) ##is there a cleaner way to iterate and map over just the names?
    ## or customer_list = [customer.name for customer in customers]
    # print(customer_list)
    # print("customers are : {}".format(customer_list)
    bikes_in_customer_budget = {}

    for customer in customers:
        in_customer_budget = []
        for bike in bills.inventory:
示例#5
0
"""Import classes and lists from Bicycles.py. Create bike instances, bike shop instance, and customer instances."""

from bicycles import Bicycle, BikeShop, Customer, inventory, demand_curve

if __name__=="__main__":

    bike1 = Bicycle(inventory[0][0], inventory[0][1], inventory[0][2])
    bike2 = Bicycle(inventory[1][0], inventory[1][1], inventory[1][2])
    bike3 = Bicycle(inventory[2][0], inventory[2][1], inventory[2][2])
    bike4 = Bicycle(inventory[3][0], inventory[3][1], inventory[3][2])
    bike5 = Bicycle(inventory[4][0], inventory[4][1], inventory[4][2])
    bike6 = Bicycle(inventory[5][0], inventory[5][1], inventory[5][2])

    bikes = [bike1, bike2, bike3, bike4, bike5, bike6]

    shop_instance = BikeShop("Dave's World of Bikes", 0.20)

    customer1 = Customer(demand_curve[0][0], demand_curve[0][1])
    customer2 = Customer(demand_curve[1][0], demand_curve[1][1])
    customer3 = Customer(demand_curve[2][0], demand_curve[2][1])

    customers = [customer1, customer2, customer3]

    for customer in customers:
        print("\nCustomer Name: %s\nCustomer Budget: %d\n" % (customer.customer_name, customer.budget))
        for bike in bikes:
            if bike.cost * (1 + shop_instance.margin) <= customer.budget:
                print("Bike Model: %s, Price: %d" % (bike.model, bike.cost * (1 + shop_instance.margin)))

    print("\nInitial Inventory: ")
    for x in range(0,6):
示例#6
0
import random
from bicycles import Bicycle, BikeShop, Customer

bikes = [
    Bicycle("Off-Road XC", 75, 100), Bicycle("Off-Road GRAVITY", 70, 150),
    Bicycle("Off-Road TRAIL", 50, 250), Bicycle("Off-Road SPRORT XC", 90, 350),
    Bicycle("Off-Road ENDURO", 65, 100), Bicycle("Off-Road RECREATION", 75, 550)
    ]

shop = BikeShop("GiantShop Surplus Cycles", 20, bikes)

customers = [Customer("Hue", 200), Customer("Saigon", 500), Customer("Hanoi", 1000)]

print ("--------------------------Giant bikes Recommendation for Customer---------------------------------")
for customer in customers:

    bikes = ", ".join( bike.model for bike in shop.filter(customer.fund) )

    print ("Customer:", customer.name, "|", bikes)

print ('\n\n', "--------------------------Surplus Before Sales---------------------------------")
print (shop)

print ("--------------------------Detail Sales---------------------------------")
template = "{0} bought the {1} at ${2}, and they have ${3} left over."

for customer in customers:
    
    affordables = shop.filter(customer.fund)
    shop.sell(random.choice(affordables), customer)
    
示例#7
0
    jabba = Wheel("Jabba", 80, 37)  # obligatory Star Wars reference
    brock = Wheel("Brock", 55,
                  47)  # tough-as-nails hockey player for Johnstown Chiefs
    grady = Wheel("Grady", 40, 57)  # high-school friend

    # Define frame models.
    flyer = Frame("Flyer", "carbon", 15, 250)
    mondo = Frame("Mondo", "steel", 30, 390)
    reynolds = Frame("Reynolds", "aluminum", 20,
                     175)  # common brand of Al foil

    # Define bicycle models.
    # Sub shops:  Kopriva (sadly, long gone) and Em's (still open in Johnstown, PA)
    # Gym teachers:  Hambright (boys) and Renzi (girls) -- high school
    # Mascots:  Chief (ECHL Johnstown Chiefs) and Ram (Richland HS)
    kopriva = Bicycle("Kopriva", flyer, brock, jbc)
    ems = Bicycle("Ems", flyer, grady, jbc)
    hambright = Bicycle("Hambright", mondo, jabba, rbw)
    renzi = Bicycle("Renzi", reynolds, jabba, rbw)
    chief = Bicycle("Chief", reynolds, brock, jbc)
    ram = Bicycle("Ram", mondo, grady, rbw)

    # Stock the bicycle shop. (0-3 facilitates testing of short-stock situations.)
    shop.stock_bike(kopriva, randint(0, 3))
    shop.stock_bike(ems, randint(0, 3))
    shop.stock_bike(hambright, randint(0, 3))
    shop.stock_bike(renzi, randint(0, 3))
    shop.stock_bike(chief, randint(0, 3))
    shop.stock_bike(ram, randint(0, 3))

    # Define customers. Three friends from high school.
示例#8
0
from bicycles import Bicycle, Customer, BikeShop

if __name__ == "__main__":
    bike_1 = Bicycle('Schwinn', 'Protocol 1.0', '41 lbs.', 320.0)
    bike_2 = Bicycle('Schwinn', 'Ladies Perla', '42 lbs.', 160.0)
    bike_3 = Bicycle('Columbia', 'Palmetto', '38 lbs.', 140.0)
    bike_4 = Bicycle('Cyrusher', 'XC700', '32 lbs.', 680.0)
    bike_5 = Bicycle('Fito', 'Marina', '33 lbs.', 200.0)
    bike_6 = Bicycle('Huffy', 'Fresno', '42 lbs.', 190.0)

    person_1 = Customer('Jhon Doe', 200.00)
    person_2 = Customer('Gemma Cain', 500.00)
    person_3 = Customer('Marco Reus', 1000.00)

    shop_inventory = {
        'Protocol 1.0': (bike_1, 5),
        'Ladies Perla': (bike_2, 5),
        'Palmentto': (bike_3, 5),
        'XC700': (bike_4, 5),
        'Marina': (bike_5, 5),
        'Fresno': (bike_6, 5)
    }

    shop = BikeShop('Cycles', shop_inventory)

    person_1.affordable_bikes(shop)
    person_2.affordable_bikes(shop)
    person_3.affordable_bikes(shop)
    shop.print_inventory()
    person_1.buy('Palmentto', shop)
    person_2.buy('Protocol 1.0', shop)
示例#9
0
from bicycles import Wheel, Frame, Bicycle, BikeShop, Customer

# Define 3 wheel types
Avenir = Wheel("Avenir", 5, 25)
StaTru = Wheel("Sta Tru", 3, 35)
Aeromax = Wheel("Aeromax", 2, 75)

# Define 3 frame types
Aluminum = Frame("Aluminum", 10, 150)
Carbon = Frame("Carbon", 4, 275)
Steel = Frame("Steel", 15, 75)

# Define 6 bicycle models
Schwinn = Bicycle("Schwinn", Avenir, Aluminum)
Huffy = Bicycle("Huffy", Avenir, Steel)
Vilano = Bicycle("Vilano", StaTru, Carbon)
Diamondback = Bicycle("Diamondback", StaTru, Aluminum)
Kestrel = Bicycle("Kestrel", Aeromax, Carbon)
Windsor = Bicycle("Windsor", Aeromax, Aluminum)

# Create a bike shop with 6 models in stock and 20% markup
CycleWorld = BikeShop("Cycle World", 
                      {Schwinn: 5, Huffy: 10, Vilano: 7, Diamondback: 6, Kestrel: 2, Windsor: 8 },
                      0.20)

# Create 3 customers with funds of $200, $500, and $1000
John = Customer("John", 200)
Sally = Customer("Sally", 500)
Rich = Customer ("Rich", 1000)
customers = [John, Sally, Rich]
示例#10
0
文件: main.py 项目: ncub8/bikeshop
from bicycles import Customer
from bicycles import Bicycle
from bicycles import Shop

if __name__ == '__main__':
  bikes = [{"bike":Bicycle("Schwimm",100,250),"number":2},
          {"bike":Bicycle("Valdemort",75,1800),"number":4},
          {"bike":Bicycle("Skipper",112,350),"number":8},
          {"bike":Bicycle("Zapp",80,1500),"number":3},
          {"bike":Bicycle("George",100,800),"number":2},
          {"bike":Bicycle("Crud",200,100),"number":17}]
  bikeshop = Shop("Big Bikes",bikes,0.20)
  
  customers = [Customer("Billy",2000),Customer("Sally",1000),Customer("Joey",750)]
  
  for customer in customers:
    print customer.name + " can afford these bikes:"
    bikechoices = bikeshop.canAfford(customer.fund)
    for bike in bikechoices:
      print(bike['bike'].name)
    print ""
    
  bikeshop.printInventory()
  print ""
    
  for customer in customers:
    customer.buyBike(bikeshop)
    
  bikeshop.printInventory()
  bikeshop.printProfit()
示例#11
0
#! /usr/bin/env python3

import random
from bicycles import Bicycle, BikeShop, Customer

# First create a list of Bikes, then create a BikeShop, stocking it
# with the Bikes...

bikes = [
    Bicycle("Super Speed", 75, 100), Bicycle("Mama Jama", 70, 150),
    Bicycle("Jumper Jack", 50, 250), Bicycle("Red Racer", 90, 350),
    Bicycle("Mud Muncher", 65, 100), Bicycle("Blastoff", 75, 550)
    ]

shop = BikeShop("Eddies Bike Shop", 20, bikes)

# Now, create a list of Customers, then iterate over them, printing
# the Customer's name and the Bikes that they can afford...

customers = [Customer("Walter White", 200), Customer("Jesse Pinkman", 500), Customer("Hank Schrader", 1000)]

for customer in customers:

    bikes = ", ".join( bike.model for bike in shop.filter(customer.fund) )
    print(customer.name, "|", bikes) # should this be printing the customers name and fund??

# Print the BikeShop before making any sales...

print(shop)

# Iterate over the customers, selling each a Bike, then using a template,
示例#12
0
from random import randint
from bicycles import Bicycle, Bike_Shop, Customer, Wheel, Frame, Manufacturer

speedy = Wheel('Speedy', 4, 10)
zippy = Wheel('Zippy', 3, 20)
zoom = Wheel('Zoom', 2, 80)

aluminum = Frame("aluminum", 20, 300)
carbon = Frame("carbon", 10, 600)
steel = Frame("steel", 30, 100)

good_gears = Manufacturer("Good Gears", .1)
best_bikes = Manufacturer("Best Bikes", .15)
sweet_spokes = Manufacturer("Sweet Spokes", .2)

red_racer = Bicycle("Red Racer", speedy, steel, sweet_spokes)
blue_baron = Bicycle("Blue Baron", zippy, steel, sweet_spokes)
green_goblin = Bicycle("Green Goblin", speedy, aluminum, sweet_spokes)
purple_pony = Bicycle("Purple Pony", zippy, aluminum, best_bikes)
silver_star = Bicycle("Silver Star", zippy, carbon, best_bikes)
golden_goose = Bicycle("Golden Goose", zoom, carbon, best_bikes)
pink_porcupine = Bicycle("Pink Porcupine", zoom, aluminum, good_gears)
yellow_yak = Bicycle("Yellow Yak", speedy, carbon, good_gears)
orange_ocelot = Bicycle("Orange Ocelot", zoom, steel, good_gears)

good_gears.models = [pink_porcupine, yellow_yak, orange_ocelot]
best_bikes.models = [golden_goose, silver_star, purple_pony]
sweet_spokes.models = [red_racer, blue_baron, green_goblin]

 
def make_inventory():
示例#13
0
#Creates three customers with $200, $500, and $1000 respectively.
#Prints the name of each customer and the bikes each person can afford.
#Prints initial inventory
#Each customer buys a bike, prints name of bike, the cost, and how much money
#the customer has in his fund
#After a purchase, the bike shop prints the remaining inventory and how much
#the bike shop has made

from bicycles import Bicycle
from bicycles import BikeShop
from bicycles import Customer

if __name__ == '__main__':

    #Creates a bike shop with 6 bicycle models and charges bikes at 20% over its cost.
    b1 = Bicycle("Aero", 20, 100)
    b2 = Bicycle("TCR Advanced", 20, 380)
    b3 = Bicycle("Trinity", 20, 600)
    b4 = Bicycle("Defy", 20, 130)
    b5 = Bicycle("Contend", 20, 400)
    b6 = Bicycle("Escape", 20, 800)

    bikeshop = BikeShop("Spencer's Bike Mart", 0)
    bikeshop.inventory.extend((b1, b2, b3, b4, b5, b6))

    #Creates three customers with $200, $500, and $1000 respectively.
    p1 = Customer("Bob", 200)
    p2 = Customer("Steve", 500)
    p3 = Customer("John", 1000)

    customers = [p1, p2, p3]
示例#14
0
from bicycles import Bicycle, BicycleShop, Customer

if __name__ == "__main__":
    print("Starting up...")

    bike1 = Bicycle("Red", 20, 100)
    bike2 = Bicycle("Blue", 20, 50)
    bike3 = Bicycle("Green", 20, 200)
    bike4 = Bicycle("Black", 20, 300)
    bike5 = Bicycle("Silver", 20, 100)
    bike6 = Bicycle("Purple", 20, 150)

    customer1 = Customer("Joe", 200)
    customer2 = Customer("Sally", 500)
    customer3 = Customer("Mike", 1000)

    shop1 = BicycleShop("Bike Shop", 0.2, 0)

    print(bike1)
    print(customer1)
    print(shop1)

    shop1.addBike(bike1)
    shop1.addBike(bike2)
    shop1.addBike(bike3)
    shop1.addBike(bike4)
    shop1.addBike(bike5)
    shop1.addBike(bike6)

    print(shop1)
    for i in shop1.inventory:
示例#15
0
# Create 2 Manufacturers
# We do not want to capitalize items that cannot be instantiated
# rule: if we can instantiate it, we cpitalize it
manuf1 = Manufacturer("PureFix", 20, None)
manuf2 = Manufacturer("Diamondback", 20, None)
# Create 3 wheels
wheel1 = Wheel("700C", 5, 30)
wheel2 = Wheel("26", 7, 35)
wheel3 = Wheel("20", 5, 20)
# reate 3 frames
frame1 = Frame("aluminum", 3, 150)
frame2 = Frame("carbon", 2, 500)
frame3 = Frame("steel", 5, 75)
#Create 6 models of bike
bike1 = Bicycle("Papa", frame1, wheel1)
bike2 = Bicycle("Coolidge", frame2, wheel1)
bike3 = Bicycle("Romeo", frame3, wheel1)
bike4 = Bicycle("Diamondback Century 5", frame3, wheel1)
bike5 = Bicycle("Diamondback Interval Carbon", frame2, wheel2)
bike6 = Bicycle("Diamondback Starlet", frame3, wheel3)

#print bike1.cost()
#bike1.wheel = wheel2
#print bike1.cost()

#Add bikes to Manufacturers inventory
manuf1.catalog.append(bike1)
manuf1.catalog.append(bike2)
manuf1.catalog.append(bike3)
#return the cost of a bike
示例#16
0
import random
from bicycles import Bicycle, BikeShop, Customer

# Create a list of Bikes, then create a BikeShop, stock it
# with Bikes...

bikes = [
    Bicycle("Desert Cruiser", 35, 1500), Bicycle("Rock Climber", 25, 3800),
    Bicycle("Speed Racer", 15, 10000), Bicycle("The Aspen", 20, 8500),
    Bicycle("City Ride", 40, 855), Bicycle("Low Rider", 50, 5550)
    ]

shop = BikeShop("Bill's Bikes", 20, bikes)

# Create a list of Customers, then iterate over them, print
# the Customer's name and Bikes they can afford to buy...

customers = [Customer("Joe", 6000), Customer("Tom", 8000), Customer("Jim", 15000)]

for customer in customers:

    bikes = ", ".join( bike.model for bike in shop.filter(customer.fund) )
    print (customer.name, "|", bikes)

# Print BikeShop before making sales...

print (shop)

# Iterate over the customers, sell each a Bike, then list customer,
# what they bought, the cost, and how much $ they have left...
示例#17
0
import random
from bicycles import Bicycle, Bike_Shop, Customer

#bikes name, weight, cost to produce

bikes = [
    Bicycle("Huffy Sledgehammer", 25, 100),
    Bicycle("State Bicycle", 20, 200),
    Bicycle("Cinelli Gazzetta", 18, 500),
    Bicycle("All City Thunderdome", 15, 600),
    Bicycle("Bianchi Super Pista", 15, 800),
    Bicycle("Surly Steam Roller", 25, 400)
]
#shop name, 20% markup, list of bikes

shop = Bike_Shop("Fast Folks Cyclery", 20, bikes)

#customers name and budget
customers = [
    Customer("Mike", 200),
    Customer("Ryan", 500),
    Customer("Jon", 1000)
]

#prints customers as defined in __repr__ from bicycles.py
print(customers, "\n")

for customer in customers:
    #returns customers who can afford certain bikes within their budget
    bikes = ", ".join(bike.model_name
                      for bike in shop.can_afford(customer.budget))
示例#18
0
def main():
    print_header()
    # Create 6 different bicycle models
    bike0 = Bicycle("Trek FUEL EX 9.7 29", 25, 800)
    bike1 = Bicycle("Specialized PITCH COMP 650B", 30, 300)
    bike2 = Bicycle("Trek MARLIN 4", 45, 150)
    bike3 = Bicycle("Specialized REMEDY", 30, 600)
    bike4 = Bicycle("Specialized CYCLONE", 50, 75)
    bike5 = Bicycle("Trek TISKER", 45, 100)
    print()

    # Create bicycle shop
    bss = BikeShop("Bicycle Sports Shop")
    print()
    # Stock the shop with the bicycles. The shop should charge
    # its customers 20% over the cost of the bikes.
    bikes = [bike0, bike1, bike2, bike3, bike4, bike5]
    for bike in bikes:
        bss.stock(bike, 5, 0.2)  # 5 bikes of one model added to shop's stock
    print()

    # Create three customers. One customer has a budget of $200,
    # the second $500, and the third $1000.
    customer1 = Customer("Joe", 200)
    customer2 = Customer("Jen", 500)
    customer3 = Customer("Jerry", 1000)

    # Print the name of each customer, and a list of the bikes offered
    # by the bike shop that they can afford given their budget.
    # Make sure you price the bikes in such a way that each customer
    # can afford at least one.
    customers = [customer1, customer2, customer3]
    customer_rec_bikes = {}  # create dict for rec bikes/customer
    for customer in customers:
        #print(customer.name)
        recommended_bikes = recommend_bikes(customer, bss)
        recommended_models = [bike["model"] for bike in recommended_bikes]
        recommended_models = set(recommended_models)
        customer_rec_bikes[customer.name] = recommended_bikes
        print("Recommended bikes for {}".format(customer.name))
        for bike in recommended_models:
            print(bike)
        print()

    # Print the initial inventory of the bike shop for each bike it carries.
    # print("Initial inventory of {}:".format(bss.name))
    print("{}'s initial inventory:".format(bss.name))
    for key, value in bss.count().items():
        print("{}: {} available".format(key, value))
    print()

    # Have each of the three customers purchase a bike then print
    # the name of the bike the customer purchased, the cost,
    # and how much money they have left over in their bicycle fund.
    for customer in customers:
        bike_choice = random.choice(customer_rec_bikes[customer.name])
        print("{}'s choice: {}".format(customer.name, bike_choice["model"]))
        bike = Bicycle(model=bike_choice["model"],
                       weight=bike_choice["weight"],
                       cost=bike_choice["cost"])
        customer.buy(1, bike, bss)
        print()

    # After each customer has purchased their bike, the script should
    # print out the bicycle shop's remaining inventory for each bike,
    # and how much profit they have made selling the three bikes.
    print("{}'s inventory after sale:".format(bss.name))
    for key, value in bss.count().items():
        print("{}: {} available".format(key, value))
    print()
    print("{}'s profit after today's sale:\n${:.2f}".format(
        bss.name, bss.profit))
示例#19
0
if __name__ == '__main__':
    # create 3 different wheel types
    small = Wheel("small", 5, 40)
    medium = Wheel("medium", 10, 50)
    large = Wheel("large", 15, 60)
    wheels = [small, medium, large]

    # create 3 diffferent frames
    aluminum = Frame("aluminum", 5, 100)
    carbon = Frame("carbon", 15, 200)
    steel = Frame("steel", 25, 300)
    frames = [aluminum, carbon, steel]

    #create production
    road = Bicycle("road", small, carbon)#, 25, 500)
    mountain = Bicycle("mountain", large, carbon)#, 55, 150)
    hybrid = Bicycle("hybrid", medium, steel)#, 30, 250)
    firstprod = [road, mountain, hybrid]

    #cruiser = Bicycle("cruiser", large, steel)#, 60, 200)
    #bmx = Bicycle("bmx", small, aluminum)#, 55, 300)
    #tandem = Bicycle("tandem", large, aluminum)#, 75, 600)
    #secondprod= [cruiser, bmx, tandem]

    #create 2 suppliers
    bob = BicycleManufacturer("bob", firstprod, 10)
    bob.print_inventory()
    #Tom = BicycleManufacturer("Tom", supply2, 10)

    # create a bike shop