Hello everyone:
The program: (function metric) is to make calculations with the Metric System.
Can be calculated:
Linear measures: Meters, Liters, Kilograms
Measures surface/areas: Meters2
Measures of capacity: Meters3
We need to know where we stand and where we want to go.
The position values are:
1 mm
2 cm
3 dm
4 Mt
5 Dm
6 Hm
7 Km
8 Mm
The values of "System" are:
1>> Linear: Meters, Liters, Kilograms
2>> Surface / areas
3>> Volumes
Must be given values, which are:
"Value", "Initial Position", "End Position", "System" (where we are).
Example:
Mts 1234 >>> Km
Quantity / Value: This is the value that we estimate: 1234
Initial position is "m" = 4
End position is "km" = 7
System = 1
Print metric (1234, 4, 7, 1)
Program to calculate how many are Kg 2468 >>> mg
Print Metric (2468,1,7,1)
Program to calculate how many Liters are 4 Hectolitres
Print Metric (4,6,4,1)
Program to calculate Surface or areas
Example: 45 Km2 >> cm2
Print Metric (45,7,2,2)
Program to calculate how many are mm3 are 12 Mt3
Print Metric (12,4,1,3)
...............................................................
Function metric (cant, i, f, ti)
'lrcvs 09.05.09
'cant = value
'i = init position
'f = end position
'ti = system
Dim r, d As Double
r = 0
d = (ti * (Abs(i - f)))
If i > f Then r = cant * 10 ^ d
If i < f Then r = cant / 10 ^ d
If i = f Then r = cant
metric = r
End Function