This program is really killing me, I've gone over it at least a dozen times.
The thing is that in the instructions they need each variable to be seperate, hrIn, hrOut, minIn, minOut, and they all have to start out as an integer. For example:
Code:
ex. out @ 4:15
-
in @ 2: 45
----------------
The problem above is normally evaluated by subtracting the time out by the time in. However, since the hrs and mins are broken up if we try to do this in this case by subtracting 15 represented by minOut - 45 minIn we get a negative answer.
This is where you have this crazy calculation: if the minOut is < the minIn;
Add 60 min. to minOut, now subtract the total off minOut - minIn, finally subtract 1 from hrOut.
Code:
ex. out @ 4:15
-
in @ 2: 45
----------------
new totals:
out @ 3:75(added 60min. to 15min.)(subtracted 1hr from 4hrs)
-
in @ 2: 45
----------------
1:30 (This the time spent in the garage calculated by subtracting out - in)
Now the thing is that even after those calculations you still have two seperate integers. One that keeps track of hr, and one that keeps track of min. which is pretty much useless because you can't calculate a bill unless of course we can round the 30 and change the 1 to a 2, but I don't know how to do that either. So what I did, was use a modulo, but it only return remainders so I guess I should of used division instead to convert an integer to a float??
Code:
for example if the minute is 30, I would do the following 30 / 100 to get 0.30 then add the hr which is 1 to 0.30, to get 1.30. Then I possibly could round 1.30 up by formating the %f statement??
out @ 3:75
-
in @ 2: 45
----------------
1:30
hr 1
+
0.30
-------
1.30
Finally now we can use 1.30 to calculate parking fee, maybe, if it works, that is.
As you can tell Im pretty much losing it, I gonna give it another attempt this time trying division, instead of modulo, I think that's the only thing I can think of at this point.