-
Notifications
You must be signed in to change notification settings - Fork 0
/
dssanganChange Maker.py
110 lines (62 loc) · 3.64 KB
/
dssanganChange Maker.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#created variable that takes the input for price of an item
x = input("Price of the item: ")
#converting integers to floating points number so that we dont have difficulty with decimal numbers.
x = float(x)
#created variable that takes input for the amount given by customer for purchased item
y = input("cash tendered: ")
#converting integers to floating points number so that we dont have difficulty with decimal numbers.
y = float(y)
#created variable that tells us how much amount we have to payback to customer
result = (y - x)
#converting integers to floating points number so that we dont have difficulty with decimal numbers.
result = float(result)
#rounding decimal numbers to 2 digits after decimal points
result = round(result,2)
#prints the change we have to pay to customer
print("Change: {}".format(result))
#all the below program gives us the no.of bills we have to use to payback
#gives no.of $50.00bills we have to give
remainderZ=result%50 #gives the amount left
Z=result//50 #gives the no.of bills to give
remainderZ=round(remainderZ,2) #rounds up the amount left to 2 decimal points
print("fifty: {}".format(Z)) #prints the no.of bills to give
#gives no.of $20.00bills we have to give
remainderA=remainderZ%20 #gives the amount left
A=remainderZ//20 #gives the no.of bills to give
remainderA=round(remainderA,2) #rounds up the amount left to 2 decimal points
print("twenty: {}".format(A)) #prints the no.of bills to give
#gives no.of $10.00bills we have to give
remainderB=remainderA%10 #gives the amount left
B=remainderA//10 #gives the no.of bills to give
remainderB=round(remainderB,2) #rounds up the amount left to 2 decimal points
print("ten: {}".format(B)) #prints the no.of bills to give
#gives no.of $5.00bills we have to give
remainderC=remainderB%5 #gives the amount left
C=remainderB//5 #gives the no.of bills to give
remainderC=round(remainderC,2) #rounds up the amount left to 2 decimal points
print("fives: {}".format(C)) #prints the no.of bills to give
#gives no.of $1.00bills we have to give
remainderD=remainderC%1 #gives the amount left
D=remainderC//1 #gives the no.of bills to give
remainderD=round(remainderD,2) #rounds up the amount left to 2 decimal points
print("one: {}".format(D)) #prints the no.of bills to give
#gives no.of $0.25coins we have to give
remainderE=remainderD%0.25 #gives the amount left
E=remainderD//0.25 #gives the no.of bills to give
remainderE=round(remainderE,2) #rounds up the amount left to 2 decimal points
print("quarter: {}".format(E)) #prints the no.of bills to give
#gives no.of $0.10coins we have to give
remainderF=remainderE%0.10 #gives the amount left
F=remainderE//0.10 #gives the no.of bills to give
remainderF=round(remainderF,2) #rounds up the amount left to 2 decimal points
print("dime: {}".format(F))
#gives no.of $0.05coins we have to give
remainderG=remainderF%0.05 #gives the amount left
G=remainderF//0.05 #gives the no.of bills to give
remainderG=round(remainderG,2) #rounds up the amount left to 2 decimal points
print("nickel: {}".format(G)) #prints the no.of bills to give
#gives no.of $0.01oins we have to give
remainderH=remainderG%0.01 #gives the amount left
H=remainderG//0.01 #gives the no.of bills to give
remainderH=round(remainderH,2) #rounds up the amount left to 2 decimal points
print("penny: {}".format(H)) #prints the no.of bills to give