Ah, that makes sense. Adjust the code to account for the given day.
I would recommend dedicating a variable that will identify a call as either weekday or weekend. I would probably make this a bool type variable. For this example, I'll call make it bool is_weekend, set to false if it is a weekday call and set to true if it is a weekend call:
//all calls will be at least E1.50
full_cost = 1.5;
//adjust call duration
if(call_duration > 3)
{
call_duration -= 3; //3 minutes
}
//enforce 10hr. limit
if(call_duration > 597)
{
call_duration = 597; //10hr. limit (minus 3min. initial charge) converted to minutes
}
//identify call as a weekday or weekend call
if(chday == 'A' || chday == 'S')
{
is_weekend = true;
}
else
{
is_weekend = false;
}
//make rate determinations (calls made between 11pm to 8am ending before 5pm)
if(call_start >= 2300 && call_start <= 0800 && call_end <= 1659)
{
//weekday call
if(!is_weekend)
{
//calculate reg. rate and apply 40% discount
full_cost += (call_duration * .30) * .6;
}
//weekend call
else
{
//calculate reg. rate and apply 60% discount
full_cost += (call_duration * .30) * .4;
}
}
So on and so forth.