REM REM Date REM Instructor Name REM Assignment Chapter 1 Number 8 Page 30 REM REM Statement of problem : REM Analysis IPO. REM REM Data Requirements REM REM Constants REM REM Inputs REM REM Outputs blank sales receipt REM REM Variables REM REM Formulas REM REM Design REM REM Algorithm REM REM 1. REM 2. REM 3. REM 4. Etc. REM REM Implementation - here you begin to code. CLS DO WHILE looper3$ <> "QUIT" GOSUB teammenu INPUT "Touch enter to continue to main menu, else QUIT to exit"; looper3$ looper3$ = UCASE$(looper3$) LOOP REM Input Section REM Processing Section REM Output Section REM sumrountine =========================================================== teammenu: FOR x = 1 TO 80 PRINT "-"; NEXT x PRINT TAB(35); "Softball League Menu" PRINT PRINT TAB(5); "1. Input team and player" PRINT TAB(5); "2. Display Team and Players" PRINT TAB(5); "3. " PRINT TAB(5); "4. " PRINT TAB(5); "5. Exit Program" PRINT FOR x = 1 TO 80 PRINT "-"; NEXT x INPUT "enter your menu choice 1, 2 , 3, 4 or 5"; menuchoice SELECT CASE menuchoice CASE IS = 1 GOSUB inputteam CASE IS = 2 GOSUB processdata CASE IS = 3 PRINT "under construction" CASE IS = 4 PRINT "under construction" CASE IS = 5 END END SELECT RETURN inputteam: OPEN "c:\team.txt" FOR APPEND AS #1 DO WHILE looper$ <> "QUIT" INPUT "Enter the team name"; teamname$ DO WHILE looper2$ <> "QUIT" INPUT "Enter players first name"; firstname$ INPUT "Enter Players last name"; lastname$ INPUT "Enter Players Number"; Number$ INPUT "Enter Player Number of Hits"; Hits INPUT "Enter Player Number of At Bats"; AtBat INPUT "Enter Player Number of Home Runs"; HomeRuns count = count + 1 WRITE #1, teamname$, firstname$, lastname$, Number$, Hits, AtBat, HomeRuns PRINT "you have entered "; count; " players and have"; PRINT "to enter "; 12 - count; " more players to enter" INPUT "Touch enter to enter another player or QUIT to enter another team"; looper2$ looper2$ = UCASE$(looper2$) LOOP INPUT "Touch enter to enter another team, else quit to return to main menu"; looper$ looper$ = UCASE$(looper$) LOOP CLOSE #1 RETURN outputform: FOR x = 1 TO 80 PRINT "-"; NEXT x PRINT TAB(5); "Team Name "; TAB(15); "Player Name"; TAB(30); "Number"; PRINT TAB(40); "At Bats"; TAB(50); "Hits"; TAB(58); "Home Runs"; TAB(68); "Average" PRINT RETURN processdata: INPUT "Enter the name of the team that you want stats for"; teamname2$ CLS GOSUB outputform OPEN "c:\team.txt" FOR INPUT AS #1 DO WHILE NOT EOF(1) INPUT #1, teamname$, firstname$, lastname$, Number$, Hits, AtBat, HomeRuns IF teamname$ = teamname2$ THEN batavg = Hits / AtBat PRINT teamname$; TAB(12); lastname$; " "; firstname$; TAB(30); Number$; PRINT TAB(40); AtBat; TAB(50); Hits; TAB(58); HomeRuns; PRINT USING ".###"; TAB(68); batavg END IF LOOP CLOSE #1 FOR x = 1 TO 80 PRINT "-"; NEXT x INPUT "touch enter to continue"; anykey$ RETURN