Design a program that writes the employees.dat file. The program should accept user input until the user indicates there are no more records to write. The Employees file contains four fields (see the Input File Description). The program will use the employee ID as criteria to determine a current employee. Validate the employee ID and employee wage fields per the requirements below. You may use any of the library functions presented in Chapter 6 of the textbook to assist in validation. Your validation routines should include error messages and allow the user to correct an input error. Use an array to hold the valid ID numbers. The Input File Description is the same for both programs.
Answers
Answered by
1
Answer:
NICE QUESTION .
IF YOU CAN'T COMPREHEND
ASK ME IN MY MESSAGE.
Explanation:
import pickle
def insert():
f = open("EMPLOYEES.DAT","wb")
while True:
EMPID = int(input("enter EMPID no.."))
EMPNAME= str(input("enter name"))
EMPWAGE= int(input("enter EMPWAGES."))
EMPNO = int(input("EMP NO.."))
if EMPID and EMPNAME and EMPWAGE and EMPNO=="":
print("INVALID INPUT")
else:
x = input("add more data...") l=[EMPID,EMPNAME,EMPWAGE,EMPNO]
s = pickle.dump(l,f)
s = pickle.dump(l,f)
if x=="y" or x=="Y":
break
else:
continue
f.close()
print(insert())
Similar questions