Friday, 12 February 2021

Practical No: 14: - Write a menu driven program which insert, delete and display the details of an employee such as eid, ename and salary using Stack.








'''
Practical No. 14: Write a menu driven program which insert, delete and display
the details of an employee such as eid, ename and salary using Stack.
'''

Employee=[]
c='y'
while(c=="y" or c=="Y"):
    print("1: Add Employee Detail: ")
    print("2: Delete Employee Detail: ")
    print("3: Display Employee Detail: ")
    choice=int(input("Enter your choice: "))
    if(choice==1):
        eid=int(input("Enter Employee Id: "))
        ename=input("Enter Employee Name: ")
        salary=float(input("Enter Employee Salary: "))
        emp=(eid,ename,salary)
        Employee.append(emp)
    elif(choice==2):
        if(Employee==[]):
            print("Stack Empty")
        else:
            print("Deleted element is: ",Employee.pop())
    elif(choice==3):
        L=len(Employee)
        while(L>0):
            print(Employee[L-1])
            L=L-1
    else:
        print("Wrong Input")
    c=input("Do you want to continue? Press 'y' to Continue: ")





No comments:

Post a Comment