REM REM Date REM Instructor Name REM Assignment Chapter Cheap Student Labor REM REM Statement of problem : Produce paystubs as output of payroll system. REM Analysis IPO. REM REM Data Requirements REM REM Constants fica, sit, wc, sdi, payrate REM REM Inputs Checkno$, SSN$,Fname$,Mname$,Lname$,Address$,City$,State$ REM Zip$,Hrswk, From$,To$,Day$, REM REM Outputs YtdWC,ytdfica,ytdsdi,ytdsit,wctax,ficatax,sditax,sittax,ytdnetpay,netpay REM ytdgrosspay,grosspay, ytdrh,ytdot,ytddt,rh,ot,dt REM Checkno$, SSN$,Fname$,Mname$,Lname$,Address$,City$,State$ REM Zip$,Hrswk, From$,To$,Day$, REM REM REM REM Variables ditto outputs REM REM Formulas grosspay=rh+ot+dt, rh= hrswk*regpay, REM REM Design REM REM Algorithm REM REM 1. input payroll data using input from the keyboard. REM 2. read the tax codes and payrate using the read and data statements. REM 2. processes and store data on disk file REM 3. produce payroll paystub to printer and screen from disk file. REM 4. REM REM Implementation - here you begin to code. firstname$ = " " mname$ = " " lname$ = " " address$ = " " city$ = " " state$ = " " zip$ = " " SSN$ = " " hrswk = 0 fromdate$ = " " todate$ = " " next$ = " " choice = 0 checkno$ = " " day$ = " " CLS REM input section REM use the read data statements to initilize constants READ wc, sdi, fica, sit, payrate REM begin input from the keyboard CLS DO UNTIL next$ = "-999" CLS FOR x = 1 TO 80 PRINT "*"; NEXT x PRINT PRINT "|"; TAB(25); "Cheap Student Labor Main Menu"; TAB(80); "|" PRINT "|"; TAB(80); "|" PRINT "|"; TAB(10); "1. Input data"; TAB(50); "13. Select employee by SSN"; TAB(80); "|" PRINT "|"; TAB(10); "2. Print Edit Report"; TAB(50); "14. under const"; TAB(80); "|" PRINT "|"; TAB(10); "3. Display Edit Report"; TAB(50); "15. Undr Const"; TAB(80); "|" PRINT "|"; TAB(10); "4. Edit Data"; TAB(50); "16. Under const"; TAB(80); "|" PRINT "|"; TAB(10); "5. Edit Ok, Post to master"; TAB(50); "17.Under const"; TAB(80); "|" PRINT "|"; TAB(10); "6. Print Pay stubs"; TAB(50); "18. Undr Const"; TAB(80); "|" PRINT "|"; TAB(10); "7. Display Pay Stubs"; TAB(50); "19. Under Const"; TAB(80); "|" FOR x = 1 TO 80 PRINT "*"; NEXT x INPUT "Enter your menu choice 1,2, etc. "; choice REM begin select case statements to execute option selected from menu SELECT CASE choice CASE IS = 1 OPEN "c:/temp/cheap.txt" FOR APPEND AS #1 DO UNTIL next2$ = "-000" CLS INPUT "Enter todays date mm/dd/yy"; day$ INPUT "Enter the begining date of payroll period mm/dd/yy"; fromdate$ INPUT "Enter the ending date of the payroll period mm/dd/yy"; todate$ INPUT "Enter the check no."; checkno$ INPUT "Enter the number of hours worked during the pay period"; hrswk INPUT "Enter the employee's SSN nnn-nn-nnnn"; SSN$ INPUT "Enter the employee's First name"; firstname$ INPUT "Enter the employee's Middle initial with period:"; mname$ INPUT "Enter the employee's Last name"; lname$ INPUT "Enter the employee's Address"; address$ INPUT "Enter the employee's City"; city$ INPUT "Enter the employee's State - Two characters"; state$ INPUT "Enter the employee's Zip code:"; zip$ REM processing section REM begin selection statements if, then, else to compute regpay,otpay,dtpay IF hrswk <= 40 THEN regpay = hrswk * payrate reghrs = hrswk ELSEIF hrswk <= 80 THEN regpay = 40 * payrate reghrs = 40 otpay = (hrswk - 40) * payrate * 1.5 othrs = hrswk - 40 ELSEIF hrswk > 80 THEN regpay = 40 * payrate reghrs = 40 otpay = 40 * payrate * 1.5 othrs = 40 dtpay = (hrswk - 80) * payrate * 2 dthrs = hrswk - 80 END IF grosspay = regpay + otpay + dtpay wctax = wc * grosspay ficatax = fica * grosspay sitax = sit * grosspay sditax = sdi * grosspay netpay = grosspay - (sitax + ficatax + sditax + wctax) WRITE #1, day$, fromdate$, todate$, checkno$, hrswk, SSN$, firstname$, mname$, lname$, address$, city$, state$, zip$, grosspay, wctax, ficatax, sditax, sitax, netpay, regpay, reghrs, otpay, othrs, dtpay, dthrs INPUT "Touch anykey to enter another employee record, else enter -000 to return to main menu:"; next2$ LOOP CLOSE #1 REM option prints the edit report from the temp file. CASE IS = 2 CLS OPEN "c:/temp/cheap.txt" FOR INPUT AS #1 FOR x = 1 TO 80 LPRINT "*"; NEXT x LPRINT "|"; TAB(5); "Date"; TAB(15); "From"; TAB(25); "Todate"; TAB(35); "Ck No."; TAB(45); "HrsWk"; LPRINT TAB(55); "SSN"; TAB(65); "First Name"; TAB(80); "|" LPRINT "|"; TAB(5); "MI"; TAB(10); "Last Name"; TAB(25); "Address"; TAB(40); "City"; TAB(55); "state"; TAB(65); "Zip"; TAB(80); "|" FOR x = 1 TO 80 LPRINT "-"; NEXT x DO WHILE NOT EOF(1) INPUT #1, day$, fromdate$, todate$, checkno$, hrswk, SSN$, firstname$, mname$, lname$, address$, city$, state$, zip$, grosspay, wctax, ficatax, sditax, sitax, netpay, regpay, reghrs, otpay, othrs, dtpay, dthrs LPRINT "|"; TAB(5); day$; TAB(15); fromdate$; TAB(25); todate$; TAB(35); checkno$; TAB(45); hrswk; TAB(55); SSN$; TAB(65); firstname$; TAB(80); "|" LPRINT "|"; TAB(5); mname$; TAB(10); lname$; TAB(25); address$; TAB(40); city$; TAB(55); state$; TAB(65); zip$; TAB(80); "|" FOR x = 1 TO 80 LPRINT "-"; NEXT x LOOP CLOSE #1 REM this option displays the edit report for the temp file. CASE IS = 3 CLS OPEN "c:/temp/cheap.txt" FOR INPUT AS #1 FOR x = 1 TO 80 PRINT "*"; NEXT x PRINT "|"; TAB(5); "Date"; TAB(15); "From"; TAB(25); "Todate"; TAB(35); "Ck No."; TAB(45); "HrsWk"; PRINT TAB(55); "SSN"; TAB(65); "First Name"; TAB(80); "|" PRINT "|"; TAB(5); "MI"; TAB(10); "Last Name"; TAB(25); "Address"; TAB(40); "City"; TAB(55); "state"; TAB(65); "Zip"; TAB(80); "|" FOR x = 1 TO 80 PRINT "-"; NEXT x DO WHILE NOT EOF(1) INPUT #1, day$, fromdate$, todate$, checkno$, hrswk, SSN$, firstname$, mname$, lname$, address$, city$, state$, zip$, grosspay, wctax, ficatax, sditax, sitax, netpay, regpay, reghrs, otpay, othrs, dtpay, dthrs PRINT "|"; TAB(5); day$; TAB(15); fromdate$; TAB(25); todate$; TAB(35); checkno$; TAB(45); hrswk; TAB(55); SSN$; TAB(65); firstname$; TAB(80); "|" PRINT "|"; TAB(5); mname$; TAB(10); lname$; TAB(25); address$; TAB(40); city$; TAB(55); state$; TAB(65); zip$; TAB(80); "|" FOR x = 1 TO 80 PRINT "-"; NEXT x LOOP CLOSE #1 CASE IS = 4 CASE IS = 5 OPEN "c:/temp/cheap.txt" FOR INPUT AS #1 OPEN "C:/temp/cheapmas.txt" FOR APPEND AS #2 DO WHILE NOT EOF(1) INPUT #1, day$, fromdate$, todate$, checkno$, hrswk, SSN$, firstname$, mname$, lname$, address$, city$, state$, zip$, grosspay, wctax, ficatax, sditax, sitax, netpay, regpay, reghrs, otpay, othrs, dtpay, dthrs WRITE #2, day$, fromdate$, todate$, checkno$, hrswk, SSN$, firstname$, mname$, lname$, address$, city$, state$, zip$, grosspay, wctax, ficatax, sditax, sitax, netpay, regpay, reghrs, otpay, othrs, dtpay, dthrs LOOP CLOSE #1 CLOSE #2 KILL "C:/temp/cheap.txt" REM print the paystub from the master file. CASE IS = 6 OPEN "c:/temp/cheapmas.txt" FOR INPUT AS #1 DO WHILE NOT EOF(1) INPUT #1, day$, fromdate$, todate$, checkno$, hrswk, SSN$, firstname$, mname$, lname$, address$, city$, state$, zip$, grosspay, wctax, ficatax, sditax, sitax, netpay, regpay, reghrs, otpay, othrs, dtpay, dthrs CLS FOR x = 1 TO 80 LPRINT "-"; NEXT x LPRINT "|"; LPRINT TAB(30); "Cheap Student Labor"; LPRINT TAB(65); "No."; LPRINT TAB(70); checkno$; LPRINT TAB(80); "|" LPRINT "|"; LPRINT TAB(26); "Solano Community College"; LPRINT TAB(80); "|" LPRINT "|"; LPRINT TAB(30); "Suisun Valley Rd."; LPRINT TAB(60); "Date"; LPRINT TAB(66); day$; LPRINT TAB(80); "|" LPRINT "|"; LPRINT TAB(80); "|" LPRINT "|"; LPRINT TAB(5); firstname$; LPRINT TAB(23); mname$; LPRINT TAB(27); lname$; LPRINT TAB(60); "Pay Period"; LPRINT TAB(80); "|" LPRINT "|"; LPRINT TAB(5); address$; LPRINT TAB(60); "From"; LPRINT TAB(68); "To:"; LPRINT TAB(80); "|" LPRINT "|"; TAB(5); city$; TAB(23); state$; TAB(27); zip$; TAB(60); fromdate$; LPRINT TAB(68); todate$; TAB(80); "|" LPRINT "|"; TAB(5); SSN$; TAB(80); "|" LPRINT "|"; TAB(80); "|" LPRINT "|"; TAB(10); "Regular"; TAB(20); "Overtime"; TAB(30); "Doubletime"; TAB(80); "|" LPRINT "|"; TAB(5); "Hrs"; TAB(10); reghrs; TAB(20); othrs; TAB(30); dthrs; TAB(80); "|" LPRINT "|"; TAB(5); "Pay"; TAB(10); regpay; TAB(20); otpay; TAB(30); dtpay; TAB(80); "|" LPRINT "|"; TAB(80); "|" LPRINT "|"; TAB(15); "Grosspay"; TAB(25); "WC"; TAB(35); "SDI"; LPRINT TAB(45); "SIT"; TAB(55); "FICA"; TAB(65); "Netpay"; TAB(80); "|" LPRINT "|"; TAB(5); "Current"; TAB(15); grosspay; TAB(25); wctax; TAB(35); sditax; LPRINT TAB(45); sitax; TAB(55); ficatax; TAB(65); netpay; TAB(80); "|" LPRINT "|"; TAB(5); "YTD"; TAB(80); "|" FOR x = 1 TO 80 PRINT "-"; NEXT x INPUT "Touch any key to see next employee record"; next3$ LOOP REM output section REM display the paystub fro the master file CASE IS = 7 OPEN "c:/temp/cheapmas.txt" FOR INPUT AS #1 DO WHILE NOT EOF(1) INPUT #1, day$, fromdate$, todate$, checkno$, hrswk, SSN$, firstname$, mname$, lname$, address$, city$, state$, zip$, grosspay, wctax, ficatax, sditax, sitax, netpay, regpay, reghrs, otpay, othrs, dtpay, dthrs CLS FOR x = 1 TO 80 PRINT "-"; NEXT x PRINT "|"; PRINT TAB(30); "Cheap Student Labor"; PRINT TAB(65); "No."; PRINT TAB(70); checkno$; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(26); "Solano Community College"; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(30); "Suisun Valley Rd."; PRINT TAB(60); "Date"; PRINT TAB(66); day$; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(5); firstname$; PRINT TAB(23); mname$; PRINT TAB(27); lname$; PRINT TAB(60); "Pay Period"; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(5); address$; PRINT TAB(60); "From"; PRINT TAB(68); "To:"; PRINT TAB(80); "|" PRINT "|"; TAB(5); city$; TAB(23); state$; TAB(27); zip$; TAB(60); fromdate$; PRINT TAB(68); todate$; TAB(80); "|" PRINT "|"; TAB(5); SSN$; TAB(80); "|" PRINT "|"; TAB(80); "|" PRINT "|"; TAB(10); "Regular"; TAB(20); "Overtime"; TAB(30); "Doubletime"; TAB(80); "|" PRINT "|"; TAB(5); "Hrs"; TAB(10); reghrs; TAB(20); othrs; TAB(30); dthrs; TAB(80); "|" PRINT "|"; TAB(5); "Pay"; TAB(10); regpay; TAB(20); otpay; TAB(30); dtpay; TAB(80); "|" PRINT "|"; TAB(80); "|" PRINT "|"; TAB(15); "Grosspay"; TAB(25); "WC"; TAB(35); "SDI"; PRINT TAB(45); "SIT"; TAB(55); "FICA"; TAB(65); "Netpay"; TAB(80); "|" PRINT "|"; TAB(5); "Current"; TAB(15); grosspay; TAB(25); wctax; TAB(35); sditax; PRINT TAB(45); sitax; TAB(55); ficatax; TAB(65); netpay; TAB(80); "|" PRINT "|"; TAB(5); "YTD"; TAB(80); "|" FOR x = 1 TO 80 PRINT "-"; NEXT x INPUT "Touch any key to see next employee record"; next3$ LOOP CASE IS = 13 OPEN "c:\temp\cheapmas.txt" FOR INPUT AS #1 INPUT "Enter the SSN of the employee whose records you want to see"; records$ DO WHILE NOT EOF(1) INPUT #1, day$, fromdate$, todate$, checkno$, hrswk, SSN$, firstname$, mname$, lname$, address$, city$, state$, zip$, grosspay, wctax, ficatax, sditax, sitax, netpay, regpay, reghrs, otpay, othrs, dtpay, dthrs IF SSN$ = records$ THEN grosspayytd = grosspayytd + grosspay wctaxytd = wctaxytd + wctax ficataxytd = ficataxytd + ficatax sditaxytd = sditaxytd + sditax sitaxytd = sitaxytd + sitax netpayytd = netpayytd + netpay END IF LOOP FOR x = 1 TO 80 PRINT "-"; NEXT x PRINT "|"; PRINT TAB(30); "Cheap Student Labor"; PRINT TAB(65); "No."; PRINT TAB(70); checkno$; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(26); "Solano Community College"; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(30); "Suisun Valley Rd."; PRINT TAB(60); "Date"; PRINT TAB(66); day$; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(5); firstname$; PRINT TAB(23); mname$; PRINT TAB(27); lname$; PRINT TAB(60); "Pay Period"; PRINT TAB(80); "|" PRINT "|"; PRINT TAB(5); address$; PRINT TAB(60); "From"; PRINT TAB(68); "To:"; PRINT TAB(80); "|" PRINT "|"; TAB(5); city$; TAB(23); state$; TAB(27); zip$; TAB(60); fromdate$; PRINT TAB(68); todate$; TAB(80); "|" PRINT "|"; TAB(5); SSN$; TAB(80); "|" PRINT "|"; TAB(80); "|" PRINT "|"; TAB(10); "Regular"; TAB(20); "Overtime"; TAB(30); "Doubletime"; TAB(80); "|" PRINT "|"; TAB(5); "Hrs"; TAB(10); reghrs; TAB(20); othrs; TAB(30); dthrs; TAB(80); "|" PRINT "|"; TAB(5); "Pay"; TAB(10); regpay; TAB(20); otpay; TAB(30); dtpay; TAB(80); "|" PRINT "|"; TAB(80); "|" PRINT "|"; TAB(15); "Grosspay"; TAB(25); "WC"; TAB(35); "SDI"; PRINT TAB(45); "SIT"; TAB(55); "FICA"; TAB(65); "Netpay"; TAB(80); "|" PRINT "|"; TAB(5); "Current"; TAB(15); grosspay; TAB(25); wctax; TAB(35); sditax; PRINT TAB(45); sitax; TAB(55); ficatax; TAB(65); netpay; TAB(80); "|" PRINT "|"; TAB(5); "YTD"; TAB(15); grosspayytd; TAB(25); wctaxytd; TAB(35); sditaxytd; PRINT TAB(45); sitaxytd; TAB(55); ficataxytd; TAB(65); netpayytd; TAB(80); "|" FOR x = 1 TO 80 PRINT "-"; NEXT x END SELECT INPUT "Enter -999 to quit, else touch anykey to continue"; next$ LOOP DATA .001,.005,.2,.01,10 END END