gblock@csd4.csd.uwm.edu (Gregory R Block) (04/24/91)
Could someone PLEASE upload the demo for the game Epic to ab20.larc.nasa.gov or some other FTP site??? I've been looking for it... Thanks in advance, Greg -- ------------------------------------------------------------------------------ All opinions are my own, and not those of my employer. Why? He doesn't know I'm doing this. -Wubba
IO10062@MAINE.BITNET (05/01/91)
PROGRAM BANKACOWNZ(INPUT,OUTPUT); (********************************************************************** HW 10 ***********************************************************************) { THIS PROGRAM IS DESIGNED TO ORGANIZE BANK RECORDS AND PROCESS TRANSACTIONS. IT WILL FIND OUT WHERE AND HOW MUCH MONEY I HAVE OUT OF THE THREE BANKS I'M USING. IT WILL USE RECORDS, LOOPS, ARRAYS AND FUNCTIONS..... IT IS NOT A REALISTIC SCENARIO, I HAVE $$ ??!!!! } CONST LISTLIMIT=100; TYPE STRINGS20 = PACKED ARRAY[1..20] OF CHAR; STRINGS10 = PACKED ARRAY[1..10] OF CHAR; MONEYTABLE = ARRAY ['A'..'C',1..4]OF REAL; TRANSACTIONS = RECORD MONTH: INTEGER; DAY : INTEGER; YEAR : 80..100; BANK :CHAR; ACCOUNT: CHAR; TRANSACTION : CHAR; AMOUNT : REAL; DATEKEYY :INTEGER; END; RECORDHOLDERS = ARRAY[1..LISTLIMIT] OF TRANSACTIONS; VAR RECORDHOLDER : RECORDHOLDERS; (* ARRAY OF RECORDS *) DATECASE : STRINGS10; WHERECASH : MONEYTABLE; I, COUNT:INTEGER; MORE : INTEGER; BLANK: CHAR; PROCEDURE HEADING; BEGIN WRITELN(' SAVINGS CHECKING IRA MONEYMARKET'); WRITELN(' ~~~~~~~ ~~~~~~~~~ ~~~ ~~~~~~~~~~~'); END; FUNCTION DATEKEY(YEAR,MONTH,DAY : INTEGER):INTEGER; BEGIN DATEKEY := 10000* YEAR + 100*MONTH + DAY; END; PROCEDURE READDATA; VAR WHICHBANK : CHAR; WHERESTORED: INTEGER; BEGIN FOR WHICHBANK := 'A' TO 'C' DO BEGIN FOR WHERESTORED := 1 TO 4 DO BEGIN READ(WHERECASH[WHICHBANK,WHERESTORED]); END; WRITELN; END; END; PROCEDURE WRITEARRAY; VAR WHICHBANK : CHAR; WHERESTORED : INTEGER; BEGIN HEADING; FOR WHICHBANK := 'A' TO 'C' DO BEGIN WRITE('BANK ', WHICHBANK); FOR WHERESTORED := 1 TO 4 DO WRITE (WHERECASH[WHICHBANK,WHERESTORED]:10:2); WRITELN; END; END; PROCEDURE ACCOUNTCASE(RECORDHOLDER :CHAR); VAR ACCOUNTCASE : STRINGS20 ; BEGIN CASE RECORDHOLDER OF 'S' : ACCOUNTCASE := 'SAVINGS ACCOUNT'; 'C' : ACCOUNTCASE := 'CHECKING ACCOUNT'; 'I' : ACCOUNTCASE := 'IRA ACCOUNT'; 'M' : ACCOUNTCASE := 'MONEY MARKET ACCOUNT'; END; WRITE(ACCOUNTCASE); END; PROCEDURE THECASE(RECORDHOLDER :CHAR); VAR THEASE : STRINGS10; BEGIN CASE RECORDHOLDER OF 'D' : THEASE := 'DEPOSITED.'; 'W' : THEASE := 'WITHDRAWN.'; END; WRITELN(THEASE); END; PROCEDURE READRECORDS(cownt : INTEGER; VAR COUNT : INTEGER); BEGIN WRITE('************** THE ECHO OF THE TRANSACTION DATA'); WRITELN('**************'); WHILE NOT EOF DO BEGIN (*FOR*) cownt:= cownt + 1; WITH RECORDHOLDER[cownt] DO BEGIN {WITH} READ(MONTH,DAY,YEAR,BLANK,BANK); READLN(BLANK,ACCOUNT,BLANK,TRANSACTION,AMOUNT); WRITE(MONTH:2,'/',DAY:2,'/19',YEAR:2,' AT BANK ',BANK); WRITE(' ON THE '); ACCOUNTCASE(RECORDHOLDER[cowNT].ACCOUNT) ; WRITE(' ',AMOUNT:4:2,' WAS '); THECASE(RECORDHOLDER[COWNT].TRANSACTION); DATEKEYY :=(DATEKEY(YEAR,MONTH,DAY)); END; {WITH} COUNT := COWNT; END; {FOR} END; {READRECORDS} PROCEDURE SORTRECORDS(COUNT: INTEGER); VAR LARGEST: TRANSACTIONS; LARGEPOS,I,J :INTEGER; BEGIN FOR I:= 1 TO COUNT-1 DO BEGIN LARGEPOS := I; LARGEST := RECORDHOLDER[LARGEPOS]; FOR J:= I+1 TO COUNT DO IF RECORDHOLDER[J].DATEKEYY < LARGEST. DATEKEYY THEN BEGIN LARGEPOS := J; LARGEST := RECORDHOLDER[J]; END; RECORDHOLDER[LARGEPOS] := RECORDHOLDER[I]; RECORDHOLDER[I] := LARGEST; END; END; PROCEDURE PRINTRECORDS(VAR RECORDHOLDER:RECORDHOLDERS; COUNT:INTEGER); VAR I : INTEGER; BEGIN WRITELN('****** THE ORDERED TRANSACTIONS ******'); FOR I:= 1 TO COUNT DO WITH RECORDHOLDER[I] DO BEGIN WRITE(MONTH:4,DAY:4,YEAR:4,BANK:2,ACCOUNT:2); WRITELN(TRANSACTION:2, AMOUNT:12:2); END; END; PROCEDURE WITHDRAW(RECORDHOLDER : TRANSACTIONS); VAR WBANK :CHAR; WACCOUNT : INTEGER; MONEY : REAL; MANY : INTEGER; BEGIN WBANK := RECORDHOLDER.BANK; WITH RECORDHOLDER DO CASE ACCOUNT OF 'S' : WACCOUNT := 1; 'C' : WACCOUNT :=2; 'I' : WACCOUNT :=3; 'M' : WACCOUNT :=4; END; MONEY := WHERECASH [WBANK,WACCOUNT] - RECORDHOLDER.AMOUNT; WHERECASH [WBANK,WACCOUNT] := MONEY; END; PROCEDURE DEPOSIT(RECORDHOLDER : TRANSACTIONS); VAR WBANK : CHAR; WACCOUNT: INTEGER; MONEY : REAL; MANY : INTEGER; BEGIN WITH RECORDHOLDER DO CASE BANK OF 'A' : WBANK :='A'; 'B' : WBANK :='B'; 'C' : WBANK := 'C'; END; WITH RECORDHOLDER DO CASE ACCOUNT OF 'S': WACCOUNT := 1; 'C' : WACCOUNT :=2; 'I' : WACCOUNT:= 3; 'M' : WACCOUNT :=4; END; MONEY := WHERECASH [WBANK,WACCOUNT] +RECORDHOLDER.AMOUNT; WHERECASH [WBANK,WACCOUNT] := MONEY; END; PROCEDURE PASSMONEY(RECORDHOLDER : TRANSACTIONS); VAR I: INTEGER; BEGIN IF RECORDHOLDER.TRANSACTION = 'W' THEN WITHDRAW(RECORDHOLDER) ELSE IF RECORDHOLDER.TRANSACTION = 'D' THEN DEPOSIT(RECORDHOLDER); END; PROCEDURE CASEDATE(I : INTEGER); BEGIN CASE I OF 1 : DATECASE := 'JANUARY'; 2 : DATECASE := 'FEBRUARY'; 3 : DATECASE := 'MARCH'; 4 : DATECASE := 'APRIL'; 5 : DATECASE := 'MAY'; 6 : DATECASE := 'JUNE'; 7 : DATECASE := 'JULY'; 8 : DATECASE := 'AUGUST'; 9 : DATECASE := 'SEPTEMBER'; 10 : DATECASE := 'OCTOBER'; 11 : DATECASE := 'NOVEMBER'; 12 : DATECASE := 'DECEMBER'; END; WRITE(DATECASE,' '); END; PROCEDURE SORTPASS; VAR J,I:INTEGER; FLAG: BOOLEAN; BEGIN FLAG := FALSE; FOR I := 1 TO COUNT-1 DO BEGIN IF FLAG = FALSE THEN BEGIN WRITE('ACCOUNTS FOR THE MONTH OF '); CASEDATE(RECORDHOLDER[I].MONTH); WRITELN; WRITELN; END; IF RECORDHOLDER[I].MONTH = RECORDHOLDER[I +1].MONTH THEN BEGIN FLAG := TRUE; PASSMONEY(RECORDHOLDER[I]); BEGIN WITH RECORDHOLDER[I] DO WRITE(MONTH:2,'/',DAY:2,'/',YEAR:2,' BANK ',BANK); WRITE(' FROM THE '); ACCOUNTCASE(RECORDHOLDER[I].ACCOUNT); WRITE(' ',RECORDHOLDER[I].AMOUNT:4:2,' WAS '); THECASE(RECORDHOLDER[I].TRANSACTION); END; END ELSE BEGIN FLAG := FALSE; PASSMONEY(RECORDHOLDER[I]); WITH RECORDHOLDER[I] DO BEGIN WRITE(MONTH:2,'/',DAY:2,'/',YEAR:2,' BANK ',BANK); WRITE(' FROM THE '); ACCOUNTCASE(RECORDHOLDER[I].ACCOUNT); WRITE(' ',RECORDHOLDER[I].AMOUNT:4:2,' WAS '); THECASE(RECORDHOLDER[I].TRANSACTION); END; END; IF RECORDHOLDER[I].MONTH <> RECORDHOLDER[I+1].MONTH THEN BEGIN FLAG := FALSE; WRITELN; WRITEARRAY; WRITELN; WRITE('*******************************'); WRITELN('*********************************************'); END; END; WRITELN; WRITEARRAY; WRITELN; WRITE('*******************************'); WRITELN('*********************************************') END; BEGIN (*MAIN*) PAGE; READDATA; READRECORDS(0, COUNT); SORTRECORDS(COUNT); PRINTRECORDS(RECORDHOLDER,COUNT); WRITELN('************BEGINING BALANCE************'); WRITEARRAY; WRITELN; WRITELN('*******************************************************'); WRITELN; SORTPASS; END. $ENTRY 2.09 12.91 100.00 5000.00 22.00 456.78 2000.00 500.00 100.13 77.66 250.00 1100.00 03 12 89 A I D 400.00 04 04 89 C S W 0.13 04 01 89 B C W 256.78 12 25 88 A M W 4500.00 12 24 88 C S D 4500.00 01 01 89 B I W 2000 04 15 89 C C D 2000.00 02 28 89 C M W 1050.00 03 09 89 C S D 1050.00 12 22 88 A C W 2.34 02 22 89 C S D 2.34 01 31 89 A S W 0.09 02 14 89 A C D 0.09