2012-07: Easy Math calculation
Apple’s weight is 300 g. orange’s weight is 200 g.
You measured the weight of the apples and oranges by analogue balance.
If total weight is 3200 g, how many apples and oranges are there?
(Combination is not limited as one. )If the full scale of balance is 5000 g, what angle does it show?

Il peso di una mela è 300 g e il peso di un’arancia è 200 g.
Per pesare le mele e le arance utilizzi una bilancia analogica.
Se il peso totale è 3200 g, quante mele e quante arance ci sono?
(Non c’è una sola combinazione…)
Soluzione
Il programma mette alla prova tutte le combinazioni per mele (da 0 a 10…) e arance (da 0 a 16…)
PESO_MELA =300
PESO_ARANCIA=200
PESO_TOTALE =3200
For mele=0 To 10
For arance=0 To 16
peso=PESO_MELA*mele+PESO_ARANCIA*arance
If(peso = PESO_TOTALE) Then
TextWindow.WriteLine("Mele=" + mele + ", arance = " + arance)
EndIf
EndFor
EndFor
Se il fondo scala è 5000 g, quale angolo viene visualizzato?
x:360 = 3200:5000
FONDO_SCALA=5000
TextWindow.WriteLine("------------------------------")
x=PESO_TOTALE/FONDO_SCALA*360
TextWindow.WriteLine("Scala=" + x)
TextWindow.WriteLine("------------------------------")