-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path178.py
More file actions
39 lines (29 loc) · 1.02 KB
/
178.py
File metadata and controls
39 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from tkinter import*
root= Tk()
root.title("C-178")
root.geometry("500x500")
class JUICE:
def __init__(self,fruit_name,quantity):
self.fruit= fruit_name
self.quantity= int(quantity)
self.__cost= 75
def __calculatecost(self):
total_amount= self.__cost*self.quantity
print("Your Total Cost Is :- "+ str(total_amount))
if self.fruit == "Apple":
calories= self.quantity *52
elif self.fruit == "Orange":
calories= self.quantity *47
elif self.fruit == "Mango":
calories= self.quantity *60
print("calories count for " + self.fruit +" of quantity " + str(self.quantity) + " is " + str(calories))
def getamount(self):
self.__calculatecost()
def order_juice():
fruit="Mango"
quantity= 20
obj1= JUICE(fruit,quantity)
obj1.getamount()
btn= Button(root,text="TOTAL AMOUNT" , command= order_juice)
btn.pack()
root.mainloop()