In the Oregonian Newspaper Parade Magazine of June 7, 1992 there appeared in the “ASK MARILYN” column an explanation of a previously printed question. “You make $10,000 a year. You can have a $1000 raise at the end of each year, or you can have a $300 raise at the end of each six months. Which do you choose?”
This appeared to be a good study in short programming. I worked it out on the basis of using data statements first. Then came up with a formuls that would reproduce the data. Both methods are presented here. Using DATA requires 2 READ lines in order to display the results in column format. In this way one can selectively print the desired data. The READ a and READ b apply to the 6 month periods while READ c applies to the annual raise data. READ a is used to add the first 6 month salary to the second 6 month salary.
The key to this problem is understanding that “end” means a pay period has passed, like December 31 is the end of the annual pay period so the raise is given on January 1 (theoretically). Thus the raise for 1992 is given in 1993. Not exactly a play on words but probably a precise understanding in accounting practice.
Dick Wagner
5 REM DICK WAGNER FOR THE PLOTTER 6/10/92
10 REM ASK MARILYN, OREGONIAN PARADE MAGAZINE JUNE 7, 1992
20 PRINT "YOU MAKE $10,000 A YEAR. YOU CANHAVE A $1000 RAISE AT THE END OFEACH YEAR,";
30 PRINT " OR YOU CAN HAVE A $300 RAISE AT THE END OF EACH 6 MONTHS."
40 PRINT : PRINT "WHICH DO YOU CHOOSE? 1 OR 2? "
45 PRINT : PRINT "1. $1000 AT END OF EACH YEAR 2. $300 AT THE END OF EACH 1/2 YEAR"
47 INPUT D: CLS
50 REM RUN A TEST FOR 10 YEARS, STARTING WITH 1992
90 PRINT AT 0,0;"YEAR";AT 0,8;"SALARY";AT 0,20;"SALARY";AT 1,6;"$300 RAISE";AT 1,18;"$1000 RAISE";AT 2,7;"END EACH";AT 2,20;"END EACH";AT 3,7;"6 MONTHS";AT 3,20;"12 MONTHS"
95 PRINT
100 FOR n=0 TO 9
110 LET s=10000
120 READ a
125 READ b
130 READ c
135 PRINT 1992+n;TAB 8;s+(a+b);TAB 20;s+c
140 NEXT n
150 DATA 0,300,0,600,900,1000,1200,1500,2000,1800,2100,3000,2400,2700,4000,3000,3300,5000,3600,3900,6000,4200,4500,7000,4800,5100,8000,5400,5700,9000
200 IF D=1 THEN PRINT : PRINT "You selected a raise of $1000 atthe end of each year."
210 IF D=1 THEN PRINT : PRINT "So you lost on that one!"
220 PRINT : IF D=2 THEN PRINT "You selected a raise of $300 at the end of each half year."
230 PRINT : IF D=2 THEN PRINT "You will win for a long time on that choice."
5 REM DICK WAGNER FOR THE PLOTTER 6/10/92
10 REM ASK MARILYN, OREGONIAN PARADE MAGAZINE JUNE 7, 1992
20 PRINT "YOU MAKE $10,000 A YEAR. YOU CANHAVE A $1000 RAISE AT THE END OFEACH YEAR,";
30 PRINT " OR YOU CAN HAVE A $300 RAISE AT THE END OF EACH 6 MONTHS."
40 PRINT : PRINT "WHICH DO YOU CHOOSE?1 OR 2? "
45 PRINT : PRINT "1. $1000 AT END OF EACH YEAR 2. $300 AT THE END OF EACH 1/2 YEAR"
47 INPUT A: CLS
50 REM RUN A TEST FOR 10 YEARS, STARTING WITH 1992
90 PRINT AT 0,0;"YEAR";AT 0,8;"SALARY";AT 0,20;"SALARY";AT 1,6;"$300 RAISE";AT 1,18;"$1000 RAISE";AT 2,7;"END EACH";AT 2,20;"END EACH";AT 3,7;"6 MONTHS";AT 3,20;"12 MONTHS"
95 PRINT
100 FOR n=0 TO 18 STEP 2
110 LET s=10000
135 PRINT 1992+n/2;TAB 8;s+600*n+300;TAB 20;s+1000*n/2
140 NEXT n
200 IF A=1 THEN PRINT : PRINT "You selected a raise of $1000 atthe end of each year."
210 IF A=1 THEN PRINT : PRINT "So you lost on that one!"
220 PRINT : IF A=2 THEN PRINT "You selected a raise of $300 at the end of each half year."
230 PRINT : IF A=2 THEN PRINT "You will win for a long time on that choice!"
Transcription note: the listing is corrected. As printed, line 135 of the formula version prints 1992+n, so the years run 1992, 1994 and so on to 2010; corrected to 1992+n/2.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.