bewerking=bewerking2.proc
operator=!randitem +,-

getal=!randitem 1,2,3,4
factor=!randitem 2,3,4
n=$teller
!if $graad=0
    R=$teller
!else
    R=$graad
!endif

!if $R=1    
    TELLER1=!randitem -1,-3,-5,-7
    NOEMER1=$[-1*$factor*$TELLER1] 
!endif


!if $R=2    
    TELLER1=!randitem -1,-4,-6,-8
    NOEMER1=$[-1*$factor*$TELLER1]
!endif

!if $R=3    
    TELLER1=!randitem -1,-3,-5,-7,-9
    NOEMER1=$[(-1*$TELLER1) + $factor]
!endif


!if $R>3    
    TELLER1=!randitem -1,-3,-5,-7,-9,-11
    NOEMER1=!randitem 10,12,14,16,18
!endif




##ant1/ant2 + ant3/ant4 = ant5/ant6 
##GOED1/GOED2 + GOED3/GOED4 = GOED5/GOED6

GG=!exec pari ($getal) $operator (($TELLER1)/($NOEMER1))
!if / notin $GG
    GOED5=$GG
    GOED6=1
    EXTRA=  \rightarrow $GOED5
!else
    GG=!replace internal / by , in $GG
    GOED5=!item 1 of $GG
    GOED6=!item 2 of $GG
    EXTRA= 
!endif

GOED1=$[$getal*$NOEMER1]
GOED2=$[$NOEMER1]
GOED3=$TELLER1
GOED4=$NOEMER1

!if $taal=nl
    nivo_title=een negatieve breuk en een positief getal optellen of aftrekken
    !if $operator=+
        somtekst$n=<p align="left">Maak eerst gelijknamige breuken.<br>\
	Tel dan de (negatieve) breuk en het getal bij elkaar op. Vereenvoudig het resultaat.<br>\
	<small>indien mogelijk...</small>
        opgave$n=$getal + \frac{$TELLER1}{$NOEMER1} =
        antwoord$n=$getal + \frac{$TELLER1}{$NOEMER1} = \frac{$GOED1}{$GOED2} + \frac{$GOED3}{$GOED4} = \frac{$GOED1 + $GOED3}{$GOED4} = \frac{$[$GOED1 + $GOED3]}{$GOED4} \rightarrow \frac{$GOED5}{$GOED6} $EXTRA
    !else
        somtekst$n=<p align="left">Maak eerst gelijknamige breuken.<br>\
	Trek de (negatieve) breuk van het getal  af. Vereenvoudig het resultaat.<br>\
	<small>indien mogelijk...</small>
	opgave$n=$getal - \frac{$TELLER1}{$NOEMER1} =
        antwoord$n=$getal - \frac{$TELLER1}{$NOEMER1} = \frac{$GOED1}{$GOED2} - \frac{$GOED3}{$GOED4} = \frac{$GOED1 - $GOED3}{$GOED4}  = \frac{$[$GOED1 - $GOED3]}{$GOED4} \rightarrow \frac{$GOED5}{$GOED6} $EXTRA
    !endif
!else
    nivo_title=Addition and subtraction of a negative fraction and a positive integer
    !if $operator=+
        somtekst$n=<p align="left">First make two fractions with a common denominator.<br>\
	Then add the two fractions...reduce the outcome<br><small> if possible...</small>
        opgave$n=$getal + \frac{$TELLER1}{$NOEMER1} =
        antwoord$n=$getal + \frac{$TELLER1}{$NOEMER1} = \frac{$GOED1}{$GOED2} + \frac{$GOED3}{$GOED4} = \frac{$GOED1 + $GOED3}{$GOED4} = \frac{$[$GOED1 + $GOED3]}{$GOED4} \rightarrow \frac{$GOED5}{$GOED6} $EXTRA
    !else
        somtekst$n=<p align="left">First make two fractions with a common denominator.<br>\
	Then subtract the two fractions...reduce the outcome<br><small> if possible...</small>
        opgave$n=$getal - \frac{$TELLER1}{$NOEMER1} =
        antwoord$n=$getal - \frac{$TELLER1}{$NOEMER1} = \frac{$GOED1}{$GOED2} - \frac{$GOED3}{$GOED4} = \frac{$GOED1 - $GOED3}{$GOED4}  = \frac{$[$GOED1 - $GOED3]}{$GOED4} \rightarrow \frac{$GOED5}{$GOED6} $EXTRA
    !endif
!endif