LIST w # w s s s d { w !,"MENU",! w "1: Employee Registration",!, "2: Edit Employee details",!, "3: Delete Employee details",!, "4: Exit",! r "Enter your choice",ch,!

d $case(ch,1:EMPREG,2:EDIT,3:DELETE,4:EXIT,:DEFAULT) }while(ch'=4) q EMPREG d { w # r "enter employee id",?25,":",?26,id#2:10,! i '(id?1.2N) { w "ID not valid please enter valid id",! g ID } NAME r "enter employee name",?25,":",?26,name#15:20,! i '(name?1U2.A1(1" ",1".")1U.A) { w "Name is not valid format",! g NAME } AGE r "enter employee age",?25,":",?26,age#3:20,! i '(age?1.2N) { w "Age is not a valid format",! g AGE } r "enter employee address",?25,":",?26,address#20:20,! PHONE r "enter employee phone number",?25,":",?26,phone#15:15,! i '(phone?.1(1"+")1(2N.1" "5N.1" "5N)) { w "Phone number not a valid format",! g PHONE } SALARY r "enter employee salary",?25,":",?26,salary#6:15,! i '(salary?1.N) { w "Salary not valid format",! g SALARY } s employee(id)=$LB(name,age,address,phone,salary) s count=count+1 w count," employee details registered",!,! r "Do you want to continue y/n",?25,":",cho,!,! }while((cho="y")||(cho="Y")) q ID "Sample program for list functions",! count=0 ch=0 cho=""

EDIT w w r i { # ?20,"Edit the employee details",! "enter employee id ",?20,":",?21,id,! $LF(employee(id),id)'=1 w "employee not exit",! q } w $J($LG(employee(id),1),15) w $J($LG(employee(id),2),5) w $J($LG(employee(id),4),13) w $J($LG(employee(id),3),20) w $J($LG(employee(id),5),15),! w "Which one you want to edit",!, "1:Name",!, "2:Age",!, "3:Address",!, "4:phone",!, "5:salary",! r "Enter your choice",ech,! d $case(ech,1:EDITNAME,2:EDITAGE,3:EDITADDRESS,4:EDITPHONE,5:EDITSALARY) Q EDITNAME r "Enter employee new name",?25,":",name,! s $LI(employee(id),1)=name i '(name?1U2.A1(1" ",1".")1U.A) { w "Name is not valid format",! g EDITNAME } w ?25,"Name modified",! Q EDITAGE r "Enter employee new age",?25,":",age,! s $LI(employee(id),2)=age i '(age?1.2N) { w "Age is not valid format",! g EDITAGE } w ?25,"Age modified",! Q EDITADDRESS r "Enter employee new address",?25,":",address,! s $LI(employee(id),3)=address w ?25,"Address modified",! Q EDITPHONE r "Enter employee new phone number",?25,":",phone,! s $LI(employee(id),4)=phone i '(phone?.1(1"+")1(2N.1" "5N.1" "5N)) {

w "phone number is not valid format",! g EDITPHONE } w ?25,"phone number modified",! Q EDITSALARY r "Enter employee new salary",?25,":",salary,! s $LI(employee(id),5)=salary i '(salary?1.N) { w "Salary is not valid format",! g EDITSALARY } w ?25,"Salary modified",! Q DELETE w w r w # ?20,"Delete the employee details",! "enter employee id ",?20,":",?21,id,! $J($LG(employee(id),1),15) w $J($LG(employee(id),2),5) w $J($LG(employee(id),4),13) w $J($LG(employee(id),3),20) w $J($LG(employee(id),5),15),! r "Do you want to delete this employee y/n",dch,! i (dch="y")||(dch="Y") { K employee(id) w employee(id)," details deleted",! } Q EXIT w "Thank you",! q DEFAULT w "Out of choice",! s count=count+1 i count>3 { w "You tried 3 times program going to quit" s ch=4 } q

Sign up to vote on this title
UsefulNot useful