How to split time up

closed account (zU5NwA7f)
Here is code that I got so far. But the problem is I cant split time up. For example if my starting time is 05.00 and length of call is 180 minutes (3 Hours). Total hours is 8 hours. That make 05.00 to 06.59 is 719 minutes. 7.00 to 8.00 is an hour. so that mean first one content 719 minutes * 0.20? and other one is 1*0.40=?. When I add em up I will get 143.80 + 0.40= 183.80

Byway my code is in minutes;

Each time have different rate:

here is rate:

0.00 to 6.59= 0.20
7.00 to 19.00 = 0.40
19.01 to 23.59 = 0.15

1
2
3
4
5
6
7
8
9
10
11
    
    if ((orgtime > 0.00 && orgtime < 06.00) && (totalminutes2 > 0 && totalminutes2 < 419))
    {
        totalfee = talk_time * RATE1;
        cout << "Your Fee for this call is " << totalfee << endl;
    }
    else if (((totalminutes2 > 420) && (totalminutes2 < 1140)) && ((totalminutes2 > 0 && totalminutes2 < 419)))
    {
        tc= totalminutes2 - 419;
        totalfee1 = totalminutes2 * RATE1;
    }
Last edited on
Topic archived. No new replies allowed.