-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExpenditure_Using_File.py
53 lines (48 loc) · 2.79 KB
/
Expenditure_Using_File.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
class Expenditure:
total_money = 0
peoples = []
money = []
total_collected_rupee = 0
no = 0
def __init__(self):
Expenditure.total_money = int(input("Enter Total Expenditure of Hole Purchase : "))
f.write("Time is : "+str(Expenditure.getdate(self)))
f.write("\nTotal Money Paid : "+str(Expenditure.total_money)+" RS\n")
Expenditure.no = int(input("Enter How Many Peoples are takes Part: "))
for i in range(0, Expenditure.no):
name = input("\nEnter Name of People : ")
Expenditure.peoples.append(name)
rupee = int(input("Enter How Many Rupuees He Give : "))
Expenditure.money.append(rupee)
f.write("\t"+name+" \t"+str(rupee)+"\n")
Expenditure.total_collected_rupee = Expenditure.total_collected_rupee + rupee
def calculation(self):
divide_money = int(Expenditure.total_money / Expenditure.no)
for i in range(0,Expenditure.no):
if Expenditure.money[i] < divide_money:
required_give_money = divide_money - Expenditure.money[i]
print(">>>"+Expenditure.peoples[i]+" Gives "+str(Expenditure.money[i])+" RS")
print("Total Expenditure is : "+str(divide_money)+" RS Then")
print(""+Expenditure.peoples[i]+" will Give "+str(required_give_money)+" RS\n")
f.write("\n>>>" + Expenditure.peoples[i] + " Gives " + str(Expenditure.money[i]) + " RS")
f.write("\nTotal Expenditure is : " + str(divide_money) + " RS Then")
f.write("\n" + Expenditure.peoples[i] + " will Give " + str(required_give_money) + " RS\n")
else:
required_take_money = Expenditure.money[i] - divide_money
print(">>>"+Expenditure.peoples[i] + " Gives " + str(Expenditure.money[i])+" RS")
print("Total Expenditure is : " + str(divide_money) + " RS Then")
print(""+Expenditure.peoples[i] + " will Take " + str(required_take_money)+" RS\n")
f.write("\n>>>" + Expenditure.peoples[i] + " Gives " + str(Expenditure.money[i]) + " RS")
f.write("\nTotal Expenditure is : " + str(divide_money) + " RS Then")
f.write("\n" + Expenditure.peoples[i] + " will Take " + str(required_take_money) + " RS\n")
f.write("\n\n")
def getdate(self):
import datetime
return datetime.datetime.now()
f = open("Expenditure_log.txt","a")
print("\n*****Expenditure Management System***")
day = Expenditure()
print("\n\n\t****Total Money Expenditure****\nRemaining Money after Paying :",str(Expenditure.total_collected_rupee-Expenditure.total_money),"RS\n")
f.write("Remaining Money after Paying :"+str(Expenditure.total_collected_rupee-Expenditure.total_money)+" RS\n")
day.calculation()
f.close()