How much do you know about profit and loss?
Do you know how much you would make if you sold your car, or even your bike?
How to play
You will be given five minutes to answer as many questions as possible, and you may press P and RETURN for pass if you cannot work out an answer.
You will not be penalised for 'passes'.
At the end of five minutes, or sooner if you enter N for NO in answer to the question "do you want any more", your score sheet showing tries, correct answers and average time per answer will appear. If you wish to proceed, then press Y and RETURN and the program will continue to ask you questions.
You can have two tries at each question if you wish. After the first attempt, you will be given a hint as to the correct answer. If your second answer is wrong, you will be told the solution and how it was obtained.
If you cannot work out an answer then press ? and RETURN and your computer will turn into a calculator and you can then used the normal mathematical symbols on the keyboard. To clear the calculator from the screen press AC and RETURN. For the calculators answer press = and RETURN. To return to the main game press ? and RETURN. Always remember to press RETURN after each required response.
Programming hints
This program includes a useful procedure that enables a programmer to fit a sentence, or string, of any length onto a screen of any size, without splitting a word between one screen line and another, i.e. wraparound. This procedure is called PROC_FITIN and is found on line 530.
Assign the string, or sentence in quotes, to variable FL$. B holds the number of characters on the screen in the case of Mode 4 it is 40. On exit the field FL$ contains the string, or sentence, re-formatting so no words are split between one 40 column line and another.
You may want to add some different types of problems on profit and loss. To do this, instead of W alternating between -1 and +1, it should be allowed to take a random value between 0 and one more than the number of problem types you are going to add. The details of the problem must be put in the PROC_QUESTION procedure. Q$ holds the question, H$ the hint, A and A$ the answer and L$, M$ and N$ the answer and explanation.
10 REM QUIZ - PROFIT AND LOSS 20 REM COPYRIGHT (C) G.LUDINSKI 1983 30 MODE 4 40 DIM IP$(255) 50 S$=" " 60 HC$=" Highest score ":HK$=" Sc ore " 70 COLOUR1:COLOUR128:PRINT'''" Q uiz game 1 - Profit and Loss" 80 PRINT'' 90 INPUT"Hello, what's your name ",NA M$:PRINT'"Here are some problems ";:IF N AM$<>"NO SOUND" THEN PRINTNAM$ ELSE PRIN T 100 TIME=0:P=0:MAX=0:C=0:W=1 110 T=1:I$="" 120 P=P+1 130 PROC_QUESTION 140 PRINT'' 150 PRINT:PRINTQ$;" = "; 160 PROC_KEYIN:PRINT 170 IF I$="?" THEN PROC_CALC 180 IF ABS(VAL(I$)-A)<= X AND I$<>"" T HEN 200 190 GOTO220 200 PRINT'"Yes, congratulations":C=C+1 :PRINT:IF NAM$="NO SOUND" THEN GOTO250 210 SOUND 1,-10,12,10:SOUND1,-10,20,10 :SOUND1,-10,28,10:SOUND1,-10,32,20:SOUND 1,-10,14,20:GOTO250 220 IF T=1 THEN PRINT'"No, "H$", try a gain.":T=2:RB$=INKEY$(3000):CLS:PRINT'': GOTO150 230 PRINT'"Sorry, the answer is = "''L $''M$ 240 PRINT'N$ 250 IF TIME>= 30000 THEN PROC_SCORE 260 PRINT'"More? (Y/N)";:PROC_KEYIN:PR INT 270 IF I$<>"Y" AND I$<>"N" AND I$<>"" AND I$<>"YES" AND I$<>"NO" THEN 260 280 IF I$="Y" OR I$="YES" OR I$="" THE N T=1:CLS:GOTO110 290 PROC_SCORE 300 GOTO900 310 REM 320 DEFPROC_QUESTION 330 L$="":M$="":N$="":B=40:X=1 340 E=RND(9):F=INT(RND(1)*90+10):E$=ST R$(E):F$=STR$(F) 350 W=-W 360 IF W=1 THEN 430 370 FL$="If a shopkeeper buys chocolat es for "+F$+" pence and sells them for " +STR$(E+F)+" pence, his profit as a perc entage of his cost price" 380 PROC_FITIN:Q$=FL$ 390 H$="Percentage profit = ((sell - cost) / cost) x 100 % where sell = selling price and cost = cost price" 400 A=INT(E/F*100):A$=STR$(A) 410 L$=A$+" %" 420 M$="as (("+STR$(E+F)+" - "+F$+")/" +F$+") x 100 % = "+STR$(INT(E/F*100)) 430 IF W=-1 THEN 520 440 V=E*100:V$=STR$(V) 450 FL$="A dealer wishes to make a pro fit of "+F$+"%. If the car cost him `"+V $+" then his selling price must be" 460 PROC_FITIN:Q$=FL$ 470 H$="Find the profit in money terms . Then add it to the cost price" 480 A=INT(V+(F*E)):A$=STR$(A):R1$=STR$ (INT(F*E)) 490 L$="`"+A$ 500 M$="as profit = ("+F$+"/100) x "+V $+" = `"+R1$ 510 N$="so selling price = "+V$+" + "+ R1$+" = `"+A$ 520 ENDPROC 530 DEFPROC_FITIN 540 LF=LEN(FL$):IF LF<= B THEN 620 550 FORI=1TOINT(LF/40) 560 EL=B*I 570 IF MID$(FL$,EL,1)=" " THEN 610 580 IF MID$(FL$,EL+1,1)=" " THEN FL$ =LEFT$(FL$,EL)+RIGHT$(FL$,LF-EL-1):LF=LF -1:GOTO610 590 FORK=1TO39:IF MID$(FL$,EL-K,1)=" " THEN FL$=LEFT$(FL$,EL-K)+LEFT$(S$,K)+ RIGHT$(FL$,LF-EL+K):LF=LF+K:GOTO610 600 NEXTK 610 NEXTI 620 ENDPROC 630 END 640 DEFPROC_CALC 650 VP=VPOS:PRINTTAB(0,22)" C alculator Mode "TAB(0,22) 660 B$="" 670 I$=GET$:PRINTI$;:B$=B$+I$:IFI$<>"= "ANDI$<>"?"ANDB$<>"AC"THEN670 680 IFB$="?"ORI$="?"THEN720 690 IFB$="AC" THEN PRINTTAB(0,23)S$;TA B(0,22):B$="":GOTO660 700 IFLEN(B$)<=1 THEN 660 710 PRINTEVAL LEFT$(B$,LEN(B$)-1);TAB( 0,22):GOTO660 720 PRINTTAB(0,22);S$;S$;TAB(0,VP-1):P ROC_KEYIN:PRINT 730 ENDPROC 740 DEFPROC_KEYIN 750 IX=1:VP=VPOS:HP=POS 760 IP$(IX)=INKEY$(10):IF IP$(IX)="" T HEN COLOUR0:COLOUR129:PRINTTAB(0,1);INT( TIME/100);" ";HC$;MAX;HK$;C:COLOUR1: COLOUR128:GOTO760 770 PRINTTAB(IX+HP,VP);IP$(IX);:IX=IX+ 1:IP$(IX)=GET$:IF IP$(IX)<>CHR$(13) THEN 770 780 I$="":FORI=1TOIX-1:I$=I$+IP$(I):NE XTI 790 ENDPROC 800 DEFPROC_SCORE 810 CLS 820 PRINT'' 830 PRINT'"Number of problems complete d = ";P 840 PRINT'"Number correct = ";C 850 TM=INT(TIME/100):PRINT'"Time taken in seconds = ";TM 860 IF C<>0 THEN PRINT'"Time per probl em = ";INT(TM/C) 870 IF C>MAX THEN MAX=C 880 TIME=0:P=0:C=0 890 ENDPROC 900 REM