bperrybap
Contributor
rakkis:That's over complicating the problem.
I'd be simpler to implement something like this:
A boolean called metric. Can be set by the user in preferences for a new dive's default value. Can be overridden in each dive.
The air consumption function would go:
float calculateAirConsumption (metric, tankSize, airUse() ) {
if metric { do metric calculation and return};
else {do imperial calculation and return};
}
There is no need to confuse the user with fields that they'll need to leave empty.
The issue isn't doing the proper calculations. It is when
switching back and forth between Imperial and Metric on
existing dives.
Metric and Imperial users want their tank volumes quoted
differently.... For the same tank!
The complexity in the s/w and in the GUI interface is
that when going back and forth between metric and Imperial
the users normally expect the working pressure to change
because the volumes are normally quoted with different
working pressures in metric vs Imperial.
Unfortunately, there is no way for the s/w to "guess" what an
Imperial working pressure should be if all it has is a Metric tank volume .
The s/w can easily get to "expected" metric values from an
Imperial Volume and working pressure, but it can't go the other
direction.
Depending on how its done, when a user switched from
Imperial to Metric everything would look great, but then
when they returned back to Imperial,
they would be very unhappy as all their original
working pressures and volumes would be much smaller and
not at all what they were expecting.
The numbers would not be wrong, just not at all what they were
expecting or had originally entered.
This is the dilemma.
There is no good simple answer for this.
--- bill