bewerking=bewerking1.proc
n=$teller

!if $bijles=1
    PLAATJE=1
!endif    

!if $graad=0
    R=$teller
!else
    R=$graad
!endif        

!if $taal=nl
    !if $HINT=1
	hint=stel de som luidt:<br>bereken het percentage appelbomen uit:<br>\
	22 appelbomen in een boomgaard met 124 bomen :<br>\
	124 appelbomen in een booomgaard met totaal 124 bomen is :<br>\
	100% &times; 124 &divide; 124 = 100% &times; 1 = 100 %  <br>\
	Dus als er maar 22 appelbomen zijn in die boomgaard geldt:<br>\
	100% &times; 22 &divide; 124 = 100% &times; 0.1774....  is ongeveer 17.74 %<br>
    !endif	

    nivo_title=Rekenen met procenten

    volkswagens=!randitem Volkswagens,Audi's,Mercedes Benz'en,Citro&euml;ns,Fiat's,Volvo's,Saab's

    appelbomen=!randitem appelbomen,pruimebomen,walnootbomen ,kersenbomen,perenbomen,notarisappel bomen,sterappel bomen
    
    dingen1=$appelbomen in een boomgaard met ,lammetjes in een kudde van ,\
    kalveren in een kudde van ,fjorde-paarden in een groep van ,\
    zittenblijvers op een groep van ,omgewaaide ligfietsen in een fietsenstalling met ,\
    gemiste penalties op een totaal van,weggewaaide dakpannen van een dak met in totaal,\
    kapotte PC's in een jaar op de ,flesjes cola in een koelkast met ,rode lollies in een zak met ,\
    jongens op een schoolplein met totaal ,voetballende meisjes op ,honden op een totaal van ,\
    katten van de in't totaal ,$volkswagens op ,vrijedagen op ,liter limonadesiroop op
    
    dingen2=fruitbomen,schapen in een wei ,runderen in een weiland,\
    paarden van een manege,leerlingen,rijwielen,genomen strafschoppen,\
    dakpannen ,verkochte computers ,flesjes frisdrank,lollies in totaal,\
    schoolkinderen,voetballers (jongens en meisjes),dieren in een asiel,\
    beesten,auto's in de maandagmorgen file, werkdagen,liter limonade

!else

    nivo_title=Calculate the percentage
    !if $HINT=1
	hint=Let's say the question is: calculate the percentage apple trees...<br>\
	22 apple trees in an orchard of 124 trees in total<br>\
	Suppose we have 124 appletrees in an orchar of 124 trees in total:<br>
	the percentage would then be:100% &times; 124 &divide; 124 = 100% &times; 1 =100%<br>\
	We just have 22 apple trees...so<br>100% &times; 22 &divide; 124 = 100% &times; 0.1774....  is approx. 17.74 %
    !endif
    
    volkswagens=!randitem Volkswagens,Audi's,Mercedes Benz'es,Citro&euml;ns,Fiat's,Volvo's,Saab's
    appelbomen=!randitem apple trees,plum trees,walnut trees,cherry trees,pear trees
    
    dingen1=$appelbomen in a orchard with ,lamb in a flock of ,\
    calf in a herd of ,pony's in a group of ,repeaters in a group of ,\
    fallen down bicycles in a bicycle shed with ,\
    missed penalties on a total of ,stressed teachers out of ,\
    blown away rooftiles from a roof with a total of ,brokendown PC's on the ,\
    bottles cola in a fridge with ,red candys in a bag with ,boys on a school yard with  ,\
    girls on ,dogs on a total of ,cats in a total of ,$volkswagens on ,days-off on ,litres concentrated lemonjuice on 
    
    dingen2=fruit-trees,sheep in a meadow,cattle in a meadow,horses of a manege,\
    pupils,bicycles,taken penalties,teachers in total,rooftiles ,sold computers ,\
    bottles limonade,sweets in total,schoolchildren,footballplayers,animals in the asylum,\
    road-killed animals,cars in a traffic jam, workingdays,litre water
    
!endif
!if $kleurenblind=0
    colors=!shuffle red,orange,green,darkgreen,purple,blue,grey,cyan,black,darkred
!else
    colors=!shuffle grey,black
!endif
    
color1=!item 1 of $colors
color2=!item 2 of $colors
num=!itemcnt $dingen1
nummer=!randint 1,$num
ding1=!item $nummer of $dingen1
ding2=!item $nummer of $dingen2

A=!randint 2,20
GOED$n=!randint 1,100
getal1=$[$(GOED$n)*$A]
getal2=$[100*$A]
    
afrondingsfactor=0
percentage=0

!if $R=1 or $R=3
    
    !if $taal=nl
	antwoord$n=Bereken hoeveel procent<br><font color=$color1 size=+1>$getal1</font> $ding1 <font color=$color2 size=+1>$getal2 </font>$ding2 is\
	<input size=6 name=ANT$n value=$(GOED$n)><br>\
	De Berekening is: <br><font color=$color1 size=+1>100% &times;($getal1 &divide; $getal2) = 100% &times;$[$getal1/$getal2] =  $(GOED$n)  %</font>

	!if $wims_user=supervisor and $printbaar=0
	    somtekst$n=Bereken hoeveel procent<br><font color=$color1 size=+1>$getal1</font> $ding1  <font color=$color2 size=+1>$getal2 </font>$ding2 is. <input size=6 name=ANT$n value=$(GOED$n)> %
	!else
	    somtekst$n=Bereken hoeveel procent<br><font color=$color1 size=+1>$getal1</font> $ding1  <font color=$color2 size=+1>$getal2 </font>$ding2 is. <input size=6 name=ANT$n value=$(ANT$n)> %
        !endif
    !else
	antwoord$n=Calculate the percentage:<br><font color=$color1 size=+1>$getal1</font> $ding1 <font color=$color2 size=+1>$getal2 </font>$ding2 is\
	<input size=6 name=ANT$n value=$(GOED$n)><br>\
	The calculation is: <br><font color=$color1 size=+1>100% &times;($getal1 &divide; $getal2) = 100% &times;$[$getal1/$getal2] =  $(GOED$n)  %</font>

	!if $wims_user=supervisor and $printbaar=0
	    somtekst$n=Calculate the percentage:<br><font color=$color1 size=+1>$getal1</font> $ding1  <font color=$color2 size=+1>$getal2 </font>$ding2 is. <input size=6 name=ANT$n value=$(GOED$n)> %
	!else
	    somtekst$n=Calculate the percentage:<br><font color=$color1 size=+1>$getal1</font> $ding1  <font color=$color2 size=+1>$getal2 </font>$ding2 is. <input size=6 name=ANT$n value=$(ANT$n)> %
        !endif
    !endif	
!endif


!if $R=2 or $R>3

    !if $taal=nl    
	antwoord$n=<font color=$color1 size=+1>$getal1</font> $ding1 <input size=6 name="" value=$getal2> $ding2 is <font color=$color2 size=+1>$(GOED$n) %</font>\
	<br>Het goede antwoord is <br><font color=$color1 size=+1>100% &times;($getal1 &divide; $getal2) = 100% &times;$[$getal1/$getal2] =  $(GOED$n)  %</font>
	!if $wims_user=supervisor and $printbaar=0
	    somtekst$n=Bereken het volgende sommetje<br><font color=$color1 size=+1>$getal1</font> $ding1 <input size=6 name=ANT$n value=$getal2> $ding2 is <font size=+2>$(GOED$n) %</font>
	!else
	    somtekst$n=Bereken het volgende sommetje<br><font color=$color1 size=+1>$getal1</font> $ding1 <input size=6 name=ANT$n value=$(ANT$n)> $ding2 is <font size=+2>$(GOED$n) %</font>
	!endif
	GOED$n=$getal2
    !else
	antwoord$n=<font color=$color1 size=+1>$getal1</font> $ding1 <input size=6 name="" value=$getal2> $ding2 is <font color=$color2 size=+1>$(GOED$n) %</font>\
	<br>The correct answer is: <br><font color=$color1 size=+1>100% &times;($getal1 &divide; $getal2) = 100% &times;$[$getal1/$getal2] =  $(GOED$n)  %</font>
	!if $wims_user=supervisor and $printbaar=0
	    somtekst$n=Calculate:<br><font color=$color1 size=+1>$getal1</font> $ding1 <input size=6 name=ANT$n value=$getal2> $ding2 is <font size=+2>$(GOED$n) %</font>
	!else
	    somtekst$n=Calculate:<br><font color=$color1 size=+1>$getal1</font> $ding1 <input size=6 name=ANT$n value=$(ANT$n)> $ding2 is <font size=+2>$(GOED$n) %</font>
	!endif
	GOED$n=$getal2
    !endif	
!endif

!if $PLAATJE=1
    schaalverdeling=$empty
    schaaltekst=$empty

    !for p=0 to 10
	schaalverdeling=!append line line -2,$[$p*10*$A],10,$[$p*10*$A],red to $schaalverdeling
	schaaltekst=!append line text black,-2,$[$p*10*$A],normal,$[$p*10] % to $schaaltekst
    !next p
    
    plaatje$n=300,300\
    transparent white\
    xrange -2,10\
    yrange $[-1*$getal2/10],$[11*$getal2/10]\
    linewidth 15\
    frect 1,0,5,$getal2,$color2\
    frect 5,0,9,$getal1,$color1\
    linewidth 1\
    $schaalverdeling\
    $schaaltekst
    
!endif