bewerking=bewerking2.proc
operator=!randitem +,-
n=$teller
!if $graad=0
    R=$teller
!else
    R=$graad
!endif
!if $R=1    
    getal=!randitem 1,2,3,4,5,6
    TELLER1=!randitem 1,3
    factor=!randitem 1,2,3,4,5,6,7,8 
    NOEMER1=$[$TELLER1+$factor]
!endif


!if $R=2    
    getal=!randitem 1,2,3,4,5,6
    TELLER1=!randitem 5,7,9
    factor=!randitem 1,2,3,4,5,6,7,8 
    NOEMER1=$[$TELLER1+$factor]
!endif

!if $R=3    
    getal=!randitem 1,2,3,4,5,6
    TELLER1=!randitem 1,3,5,7,9,11
    factor=!randitem 1,2,3,4,5,6,7,8 
    NOEMER1=$[$TELLER1+$factor]
!endif


!if $R>3    
    getal=!randitem 4,5,6,7,8,9,10
    TELLER1=!randitem 1,3,5,7,9,11
    factor=!randitem 1,2,3,4,5,6,7,8 
    NOEMER1=$[$TELLER1+$factor]
!endif


GG=!exec pari $getal $operator $TELLER1/$NOEMER1
!if / notin $GG
    GOED5=$GG
    GOED6=1
    EXTRA=  = $GOED5
!else
    GG=!replace internal / by , in $GG
    GOED5=!item 1 of $GG
    GOED6=!item 2 of $GG
    EXTRA=
!endif
GOED1=$[$getal*$GOED6]
GOED2=$[$GOED6]
GOED3=$TELLER1
GOED4=$NOEMER1


##ant1/ant2 + ant3/ant4 = ant5/ant6 
##GOED1/GOED2 + GOED3/GOED4 = GOED5/GOED6
!if $taal=nl
    nivo_title=een breuk en een getal optellen/aftrekken & vereenvoudigen
    !if $operator=+
        somtekst$n=<p align="left">Maak eerst gelijknamige breuken<br>En tel dan de breuk en het getal op en vereenvoudig het resultaat<br>
        opgave$n=$getal + \frac{$TELLER1}{$NOEMER1} =
        antwoord$n=$getal + \frac{$TELLER1}{$NOEMER1} = \frac{$GOED1}{$GOED2} + \frac{$GOED3}{$GOED4} = \frac{$GOED1 + $GOED3}{$GOED4} = \frac{$GOED5}{$GOED6} $EXTRA
    !else
        somtekst$n=<p align="left">Maak eerst gelijknamige breuken<br>En trek de breuk en het getal van elkaar af en vereenvoudig het resultaat<br>
        opgave$n=$getal - \frac{$TELLER1}{$NOEMER1} =
        antwoord$n=$getal - \frac{$TELLER1}{$NOEMER1} = \frac{$GOED1}{$GOED2} - \frac{$GOED3}{$GOED4} = \frac{$GOED1 - $GOED3}{$GOED6} = \frac{$GOED5}{$GOED6} $EXTRA
    !endif
!else
    nivo_title=Addition and subtraction of a fraction and an integer
    !if $operator=+
        somtekst$n=<p align="left">First step is to find a common denominator.<br>\
	Then add the two fractions.<br>\
	And reduce the result as far as you can...	
        opgave$n=$getal + \frac{$TELLER1}{$NOEMER1} =
        antwoord$n=$getal + \frac{$TELLER1}{$NOEMER1} = \frac{$GOED1}{$GOED2} + \frac{$GOED3}{$GOED4} = \frac{$GOED1 + $GOED3}{$GOED4} = \frac{$GOED5}{$GOED6} $EXTRA
    !else
        somtekst$n=<p align="left">First step is to find a common denominator.<br>\
	Then subtract the two fractions.<br>\
	And reduce the result as far as you can...
        opgave$n=$getal - \frac{$TELLER1}{$NOEMER1} =
        antwoord$n=$getal - \frac{$TELLER1}{$NOEMER1} = \frac{$GOED1}{$GOED2} - \frac{$GOED3}{$GOED4} = \frac{$GOED1 - $GOED3}{$GOED6} = \frac{$GOED5}{$GOED6} $EXTRA
    !endif
!endif
