Skip to content

Commit 98f4f4d

Browse files
authored
Add files via upload
1 parent febdc27 commit 98f4f4d

File tree

40 files changed

+556
-0
lines changed

40 files changed

+556
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from menu_item import MenuItem
2+
3+
class Drink(MenuItem):
4+
def __init__(self, name, price, volume):
5+
super().__init__(name, price)
6+
self.volume = volume
7+
8+
def info(self):
9+
return self.name + ': $' + str(self.price) + ' (' + str(self.volume) + 'mL)'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from menu_item import MenuItem
2+
3+
class Food(MenuItem):
4+
def __init__(self, name, price, calorie_count):
5+
super().__init__(name, price)
6+
self.calorie_count = calorie_count
7+
8+
def info(self):
9+
return self.name + ': $' + str(self.price) + ' (' + str(self.calorie_count) + 'kcal)'
10+
11+
def calorie_info(self):
12+
print('kcal: ' + str(self.calorie_count))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class MenuItem:
2+
def __init__(self, name, price):
3+
self.name = name
4+
self.price = price
5+
6+
def info(self):
7+
return self.name + ': $' + str(self.price)
8+
9+
def get_total_price(self, count):
10+
total_price = self.price * count
11+
12+
if count >= 3:
13+
total_price *= 0.9
14+
15+
return round(total_price)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from food import Food
2+
from drink import Drink
3+
4+
food1 = Food('Sandwich', 5, 330)
5+
food2 = Food('Chocolate Cake', 4, 450)
6+
food3 = Food('Cream Puff', 2, 180)
7+
8+
foods = [food1, food2, food3]
9+
10+
drink1 = Drink('Coffee', 3, 180)
11+
drink2 = Drink('Orange Juice', 2, 350)
12+
drink3 = Drink('Espresso', 3, 30)
13+
14+
drinks = [drink1, drink2, drink3]
15+
16+
print('Food')
17+
index = 0
18+
for food in foods:
19+
print(str(index) + '. ' + food.info())
20+
index += 1
21+
22+
print('Drinks')
23+
index = 0
24+
for drink in drinks:
25+
print(str(index) + '. ' + drink.info())
26+
index += 1
27+
28+
print('--------------------')
29+
order = int(input('Enter food item number: '))
30+
selected_food = foods[order]
31+
32+
order = int(input('Enter drink item number: '))
33+
selected_drink = drinks[order]
34+
35+
count = int(input('How many meals do you want to buy? (10% off for 3 or more): '))
36+
result = selected_food.get_total_price(count) + selected_drink.get_total_price(count)
37+
print('Your total is $' + str(result))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from menu_item import MenuItem
2+
3+
class Drink(MenuItem):
4+
def __init__(self, name, price, volume):
5+
super().__init__(name, price)
6+
self.volume = volume
7+
8+
def info(self):
9+
return self.name + ': $' + str(self.price) + ' (' + str(self.volume) + 'mL)'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from menu_item import MenuItem
2+
3+
class Food(MenuItem):
4+
def __init__(self, name, price, calorie_count):
5+
super().__init__(name, price)
6+
self.calorie_count = calorie_count
7+
8+
def info(self):
9+
return self.name + ': $' + str(self.price) + ' (' + str(self.calorie_count) + 'kcal)'
10+
11+
def calorie_info(self):
12+
print('kcal: ' + str(self.calorie_count))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
class MenuItem:
2+
def __init__(self, name, price):
3+
self.name = name
4+
self.price = price
5+
6+
def info(self):
7+
return self.name + ': $' + str(self.price)
8+
9+
def get_total_price(self, count):
10+
total_price = self.price * count
11+
12+
if count >= 3:
13+
total_price *= 0.9
14+
15+
return round(total_price)
16+
17+
class Food(MenuItem):
18+
def __init__(self, name, price, calorie_count):
19+
super().__init__(name, price)
20+
self.calorie_count = calorie_count
21+
22+
def info(self):
23+
return self.name + ': $' + str(self.price) + ' (' + str(self.calorie_count) + 'kcal)'
24+
25+
def calorie_info(self):
26+
print('kcal: ' + str(self.calorie_count))
27+
28+
class Drink(MenuItem):
29+
def __init__(self, name, price, volume):
30+
super().__init__(name, price)
31+
self.volume = volume
32+
33+
def info(self):
34+
return self.name + ': $' + str(self.price) + ' (' + str(self.volume) + 'mL)'
35+
36+
37+
38+
food1 = Food('Sandwich', 5, 330)
39+
food2 = Food('Chocolate Cake', 4, 450)
40+
food3 = Food('Cream Puff', 2, 180)
41+
42+
foods = [food1, food2, food3]
43+
44+
drink1 = Drink('Coffee', 3, 180)
45+
drink2 = Drink('Orange Juice', 2, 350)
46+
drink3 = Drink('Espresso', 3, 30)
47+
48+
drinks = [drink1, drink2, drink3]
49+
50+
print('Food')
51+
index = 0
52+
for food in foods:
53+
print(str(index) + '. ' + food.info())
54+
index += 1
55+
56+
print('Drinks')
57+
index = 0
58+
for drink in drinks:
59+
print(str(index) + '. ' + drink.info())
60+
index += 1
61+
62+
print('--------------------')
63+
64+
food_order = int(input('Enter food item number: '))
65+
selected_food = foods[food_order]
66+
67+
drink_order = int(input('Enter drink item number: '))
68+
selected_drink = drinks[drink_order]
69+
70+
# Take input from the console and assign it to the count variable
71+
count = int(input('How many meals would you like to purchase? (10% off for 3 or more): '))
72+
73+
# Call the get_total_price method from selected_food and from selected_drink
74+
result = selected_food.get_total_price(count) + selected_drink.get_total_price(count)
75+
76+
# Output 'Your total is $____'
77+
print('Your total is $ ' + str(result))
78+
print('Happy to help you!!!')
79+
print('Made by ASHANK')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class MenuItem:
2+
def __init__(self, name, price):
3+
self.name = name
4+
self.price = price
5+
6+
def info(self):
7+
return self.name + ': $' + str(self.price)
8+
9+
def get_total_price(self, count):
10+
total_price = self.price * count
11+
12+
if count >= 3:
13+
total_price *= 0.9
14+
15+
return round(total_price)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from food import Food
2+
from drink import Drink
3+
4+
food1 = Food('Sandwich', 5, 330)
5+
food2 = Food('Chocolate Cake', 4, 450)
6+
food3 = Food('Cream Puff', 2, 180)
7+
8+
foods = [food1, food2, food3]
9+
10+
drink1 = Drink('Coffee', 3, 180)
11+
drink2 = Drink('Orange Juice', 2, 350)
12+
drink3 = Drink('Espresso', 3, 30)
13+
14+
drinks = [drink1, drink2, drink3]
15+
16+
print('Food')
17+
index = 0
18+
for food in foods:
19+
print(str(index) + '. ' + food.info())
20+
index += 1
21+
22+
print('Drinks')
23+
index = 0
24+
for drink in drinks:
25+
print(str(index) + '. ' + drink.info())
26+
index += 1
27+
28+
print('--------------------')
29+
30+
food_order = int(input('Enter food item number: '))
31+
selected_food = foods[food_order]
32+
33+
drink_order = int(input('Enter drink item number: '))
34+
selected_drink = drinks[drink_order]
35+
36+
# Take input from the console and assign it to the count variable
37+
count = int(input('How many meals would you like to purchase? (10% off for 3 or more): '))
38+
39+
# Call the get_total_price method from selected_food and from selected_drink
40+
result = selected_food.get_total_price(count) + selected_drink.get_total_price(count)
41+
42+
# Output 'Your total is $____'
43+
print('Your total is $ ' + str(result))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Import the MenuItem class using 'from' 'import'
2+
from menu_item import MenuItem
3+
4+
# Inherit the MenuItem class and define the Drink class
5+
class Drink(MenuItem):
6+
pass
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Import the MenuItem class using 'from' 'import'
2+
from menu_item import MenuItem
3+
4+
# Inherit the MenuItem class and define the Food class
5+
class Food(MenuItem):
6+
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class MenuItem:
2+
def __init__(self, name, price):
3+
self.name = name
4+
self.price = price
5+
6+
def info(self):
7+
return self.name + ': $' + str(self.price)
8+
9+
def get_total_price(self, count):
10+
total_price = self.price * count
11+
12+
if count >= 3:
13+
total_price *= 0.9
14+
15+
return round(total_price)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from menu_item import MenuItem
2+
3+
class Drink(MenuItem):
4+
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from menu_item import MenuItem
2+
3+
class Food(MenuItem):
4+
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class MenuItem:
2+
def __init__(self, name, price):
3+
self.name = name
4+
self.price = price
5+
6+
def info(self):
7+
return self.name + ': $' + str(self.price)
8+
9+
def get_total_price(self, count):
10+
total_price = self.price * count
11+
12+
if count >= 3:
13+
total_price *= 0.9
14+
15+
return round(total_price)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Import the Food class and Drink class
2+
from food import Food
3+
from drink import Drink
4+
5+
# Create an instance of the Food class and assign it to the food1 variable
6+
food1 = Food('Sandwich',5)
7+
8+
# Call the info method from food1 and output the return value
9+
print(food1.info())
10+
11+
# Create an instance of the Drink class and assign it to the drink1 variable
12+
drink1 = Drink('Coffee',3)
13+
14+
# Call the info method from drink1 and output the return value
15+
print(drink1.info())
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from menu_item import MenuItem
2+
3+
class Drink(MenuItem):
4+
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from menu_item import MenuItem
2+
3+
class Food(MenuItem):
4+
# Define the calorie_info method
5+
def calorie_info(self):
6+
print('kcal: ' + str(self.calorie_count))
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class MenuItem:
2+
def __init__(self, name, price):
3+
self.name = name
4+
self.price = price
5+
6+
def info(self):
7+
return self.name + ': $' + str(self.price)
8+
9+
def get_total_price(self, count):
10+
total_price = self.price * count
11+
12+
if count >= 3:
13+
total_price *= 0.9
14+
15+
return round(total_price)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from food import Food
2+
from drink import Drink
3+
4+
food1 = Food('Sandwich', 5)
5+
6+
# Set the calorie_count variable of food1 to 330
7+
food1.calorie_count = 330
8+
9+
# Call the calorie_info method from food1
10+
food1.calorie_info()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from menu_item import MenuItem
2+
3+
class Drink(MenuItem):
4+
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from menu_item import MenuItem
2+
3+
class Food(MenuItem):
4+
# Define the info method
5+
def info(self):
6+
return self.name + ': $' + str(self.price) + ' (' + str(self.calorie_count) + 'kcal)'
7+
8+
def calorie_info(self):
9+
print('kcal: ' + str(self.calorie_count))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class MenuItem:
2+
def __init__(self, name, price):
3+
self.name = name
4+
self.price = price
5+
6+
def info(self):
7+
return self.name + ': $' + str(self.price)
8+
9+
def get_total_price(self, count):
10+
total_price = self.price * count
11+
12+
if count >= 3:
13+
total_price *= 0.9
14+
15+
return round(total_price)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from food import Food
2+
from drink import Drink
3+
4+
food1 = Food('Sandwich', 5)
5+
food1.calorie_count = 330
6+
7+
# Call the info method from food1 and output the return value
8+
print(food1.info())

0 commit comments

Comments
 (0)