def prob_9_6():
    ice1 = IceCreamStand('Pops')
    ice1.describe_restaurant()
    ice1.add_flavors('vanilla')
    ice1.show_flavors()
    ice1.add_flavors('chocolate', 'strawberry', 'peanut butter')
    ice1.show_flavors()
Beispiel #2
0
from restaurant import Restaurant, IceCreamStand

restaurant = Restaurant("Lo de Charly", "parrilla")
print(restaurant.restaurant_name)
print(restaurant.cuisine_type)
restaurant.describe_restaurant()
restaurant.open()

restaurant_luigi = Restaurant("Lugi's Manssion", "Italian cuisine")
restaurant_sushi = Restaurant("Itamae sushi", "Oriental food")

restaurant_luigi.describe_restaurant()
restaurant_luigi.open()
restaurant_sushi.describe_restaurant()
restaurant_sushi.open()

griddo = IceCreamStand("Griddo", "heladeria")
griddo.describe_restaurant()
griddo.show_flavors()

Beispiel #3
0
# Importing methods from restaurant module.

from restaurant import Restaurant, IceCreamStand

# example data:
my_restaurant = Restaurant('qs', 'fast food')
my_restaurant.describe_restaurant()
my_restaurant.open_restaurant()

# example data:
my_stand = IceCreamStand('Pennys', 'ice cream shoppe')
my_stand.describe_restaurant()
my_stand.describe_ice_cream_flavors()
from restaurant import Restaurant, IceCreamStand
#flavors = ['Vainilla', 'Strawberry','apple','banana','grapes']
italian_restaurant = Restaurant('Mamma mia', 'Italian')
italian_restaurant.describe_restaurant()

ice_restaurant = IceCreamStand('Freedo', 'Ice Cream Store')
ice_restaurant.set_flavors('Vanilla', 'banana split', 'pistache', 'nutella')
ice_restaurant.describe_restaurant()
ice_restaurant.get_flavors()
Beispiel #5
0
"""导入restaurant模块"""
from restaurant import Restaurant, IceCreamStand
"""创建Restaurant实例并打印目前服务的人数"""
restaurant_1 = Restaurant("greatpizza", "pizza")
restaurant_1.set_number_served(81)
restaurant_1.read_number_served()
print("\n")
"""创建两个IceCreamStand类的实例,打印每个冰激凌店的名字和所提供的冰激凌的口味"""
IceCream1 = IceCreamStand("ice-cream_land", "icecream",
                          ['strawberry', 'yogurt', 'cheese', 'milk'])
IceCream1.describe_restaurant()
IceCream1.show_flavors()
IceCream2 = IceCreamStand("best_ice-cream", "icecream",
                          ['chocolate', 'strawberry', 'milk'])
IceCream2.describe_restaurant()
IceCream2.show_flavors()
Beispiel #6
0
from restaurant import Restaurant, IceCreamStand

restaurant = Restaurant("Seventh Taste", "Veggie")
restaurant.describe_restaurant()
restaurant.set_number_served(345)
restaurant.increment_number_served(15)

# Make an instance of the subclass. Inherited from the parent class.
my_ice_cream = IceCreamStand("Straciatella", "Ice-cream")
my_ice_cream.describe_restaurant()
my_ice_cream.get_flavors()

from restaurant import Restaurant,IceCreamStand

#创建restaurant的实例
rest=Restaurant('sugar','American flavor')
rest.set_number_served(30)
rest.show_number_served()
print()

#创建两个IceCreamStand类的实例
flavorlist_1=['chocolate','strawberry','blueberry','original']
flavorlist_2=['lemon','chocolate','strawberry','blueberry']
print("实例1")
my_IceCreamStand=IceCreamStand('icy','Chinese flavor',flavorlist_1)
my_IceCreamStand.describe_restaurant()
my_IceCreamStand.show_flavors()
print("实例2")
your_IceCreamStand=IceCreamStand('freezing','French flavor',flavorlist_2)
your_IceCreamStand.describe_restaurant()
your_IceCreamStand.show_flavors()
Beispiel #8
0
from restaurant import Restaurant, IceCreamStand

goracy_piec = Restaurant("Gorący Piec", "Pizzeria")
goracy_piec.describe_restaurant()

przystan = IceCreamStand("Przystań", "Lodziarnia")
przystan.describe_restaurant()
Beispiel #9
0
    def describe_restaurant(self):
        titled = self.name + '\n' + self.type
        return titled.title()


class IceCreamStand(Restaurant):
    def __init__(self, name, type):
        super().__init__(name, type)
        self.flavors = ['first', 'second', 'third']

    def show_flavors(self):
        print(self.flavors)


my_cream = IceCreamStand('eskimo', 'holodok')
print(my_cream.describe_restaurant())
my_cream.show_flavors()

print('---')


class User():
    def __init__(self, first_name, last_name):
        self.first_name = first_name
        self.last_name = last_name

    def describe_user(self):
        full_name = self.first_name + ' ' + self.last_name
        return full_name.title()

Beispiel #10
0
from restaurant import Restaurant, IceCreamStand
restaurant = Restaurant('泡面食堂', '苍蝇馆子')
restaurant.describe_restaurant()
restaurant.open_restaurant()
icecreamstand = IceCreamStand('肯德基', '快餐店')
icecreamstand.describe_restaurant()
icecreamstand.show_flavors()
Beispiel #11
0
from restaurant import Restaurant, IceCreamStand

# 9-1. Restaurant
restaurant = Restaurant('ooma', 'japanese')
restaurant.describe_restaurant()
restaurant.open_restaurant()

# 9-2. Three Restaurants
#res1 = Restaurant('mendokoro ramenba', 'japanese')
#res2 = Restaurant('buffalo wings n things', 'tex mex')
#res3 = Restaurant('mesa', 'filipino')
#res1.describe_restaurant()
#res2.describe_restaurant()
#res3.describe_restaurant()

# 9-4. Number Served
#print("Number of customers served: " +
#      str(restaurant.number_served))
#restaurant.set_number_served(20)
#print("Number of customers served: " +
#      str(restaurant.number_served))
#restaurant.increment_number_served(3)
#print("Number of customers served: " +
#      str(restaurant.number_served))

# 9-6. Ice Cream Stand
my_ice_cream_stand = IceCreamStand('dairy queen', 'soft serve')
my_ice_cream_stand.describe_restaurant()
my_ice_cream_stand.add_available_flavors('chocolate', 'vanilla')
my_ice_cream_stand.display_flavors()
Beispiel #12
0
from restaurant import Restaurant, IceCreamStand

resto_1 = Restaurant("raffy's", "general")
resto_1.describe_restaurant()

resto_2 = IceCreamStand("gelato", "icecream")
resto_2.describe_restaurant()
resto_2.print_flavors()
Beispiel #13
0
# 福尔餐馆实例
restaurant = Restaurant('Fuer', 'cheese')
# 打印餐馆的属性
print("The first restaurant is " + restaurant.restaurant_name + ".")
print("The best cuisine of " + restaurant.restaurant_name + " is " +
      restaurant.cuisine_type + ".")
# 调用类定义中的方法
restaurant.describe_restaurant()
restaurant.open_restaurant()

# 直接修改属性值
restaurant.read_number()
restaurant.number_serverd = 320
restaurant.read_number()
# 调用方法修改属性值
restaurant.set_number_serverd(500)
restaurant.read_number()
# 递增就餐人数
restaurant.increment_number_serverd(150)
restaurant.read_number()

# 冰淇淋小店实例
icecream_restaurant = IceCreamStand('Merlin ice', 'love')
# 父类方法
icecream_restaurant.describe_restaurant()
icecream_restaurant.open_restaurant()
icecream_restaurant.set_number_serverd(200)
icecream_restaurant.read_number()
# 子类特有方法
icecream_restaurant.read_icecream()
from restaurant import Restaurant, IceCreamStand

restaurant1 = Restaurant("guggino's", "italian cuisine")
restaurant1.describe_restaurant()

print('\n')

restaurant2 = IceCreamStand('diarhee-land', ['chocolate', 'vanilla'])
restaurant2.describe_restaurant()
restaurant2.describe_flavors_served()

print('\n')

restaurant3 = IceCreamStand('salmonella-land',
                            ['raspberry', 'cookie dough', 'mint', 'lemon'])
restaurant3.describe_restaurant()
restaurant3.describe_flavors_served()
##9-10:
from restaurant import Restaurant, IceCreamStand

italian = Restaurant("nino", "italian")
italian.describe_restaurant()
italian.open_restaurant()  #this command works perfectly.

#let's see if the subclass IceCreamStand works as well.
iscream = IceCreamStand("the fainting goat", "deserts")
iscream.describe_restaurant()
iscream.open_restaurant()
iscream.ice_cream_flavors(["vanilla", "cherry", "salted carmel", "chocolate"])
#Event the IceCreamStand() subclass works perfectly.

##9-11:
import user_admin

user1 = user_admin.Administrator("mason", "karsevar", "data scientist",
                                 "seattle", "hiking")
user1.describe_user()
user1.greet_user()
#These commends from the User2 parent class work perfectly. I need to see
#if the subclass works perfectly as well.

user1.privileges.privileges = ["managing user data", "barring bad actors"]
user1.privileges.show_privileges()
#Sweet these commands worked perfectly!!!
#I can finally move onto the next chapter.

##9-12:
from administrator import Administrator