- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetSalaryFile.py
More file actions
Latest commit
28 lines (28 loc) · 781 Bytes
/
Copy pathNetSalaryFile.py
File metadata and controls
28 lines (28 loc) · 781 Bytes
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
importpickle
bfile=open("empfile", "wb")
n=int(input("Enter the number of employees:"))
print("Enter records of Employees")
i=1
whilei<=n:
print("Record No:", i)
ename=input("Employee name:")
ebasic=int(input("Basic Salary:"))
ns=int(input("Enter the no of Night shifts: "))
hra=ebasic*.15
pf=ebasic*.08
da=ebasic*.05
totsal=ebasic+hra+da-pf+ (ns*300)
print("NET SALARY:", totsal)
edata= [i, ename, ebasic, totsal]
pickle.dump(edata, bfile)
i=i+1
bfile.close()
print("Reading the employee records from the file")
empno=1
bfile=open("empfile", "rb")
whileempno<n+1:
edata=pickle.load(bfile)
print("Record Number:", empno)
print(edata)
empno=empno+1
bfile.close()