Posted by: mickthesick November 21, 2006
C Programing question
Login in to Rate this Post:     0       ?        
/Thapap, from the look of TD's program, I can tell for sure that he has not started learning the "void" functions. So don't confuse him more by using the void function. And TD, your logic on the premium charge is flawed, just like Thapap pointed out. You are ripping the customer off by charging him double. Amount Due for premium service should be = minimum charge + daytime extra charge + nighttime extra charge. So on your code for daytime minutes, you should have: if (dayMinutes <= 75) daytime extra charge = 0; else daytime extra charge= (minutes - 75) * pDayPerMinuteCharge; Also your code on night time minutes should be: if (nightMinutes <= 100) night time extra charge = 0; else night time extra charge= (minutes - 100) * pNightPerMinuteCharge; Therefore your total amount due for premium service is: amountDue = minimum premium cahrge + daytime extra charge + nighttime extra charge.
Read Full Discussion Thread for this article