5. A bank charges RM15.00 per month plus the following cheque fees for a commercial checking account: Charges Number of Cheques RM0.25 Fewer than 20 cheques RM0.10 20 – 39 cheques RM0.08 40 – 59 cheques RM0.06 60 or more cheques Write a program that asks for the number of cheques written during the past month, then computes and displays the bank’s fees for the month. Input validation: Do not accept a negative value for the number of cheques written. could someone help me with this programming
c0c0pIe, if you want help with this question you might consider adding some additional information to your question. - What language are you programming in? - How far have you gotten on the program already?
This sounds a lot like a question from a Visual Basic book.
oo..right now i'm doing c programming..and i ask to compute all the data using c programming whether by using selction or looping
Here is a basic solution for the word problem you described: #include<stdio.h> int main() { int numchecks= 40; char input[10]; float totalfees = 0.00; float fees = 0; float mnthcharge = 15.00; float ls20 = 0.25; float ls40 = 0.10; float ls60 = 0.08; float mt60 = 0.06; fputs("Enter number of checks:",stdout); fflush(stdout); fgets(input,sizeof input, stdin); numchecks = atoi(input); if ( numchecks < 20) { totalfees = mnthcharge + ( numchecks * ls20); } else if (numchecks < 40) { totalfees = mnthcharge + ( numchecks * ls40); } else if(numchecks < 60) { totalfees = mnthcharge + ( numchecks * ls60); } else if (numchecks >= 60) { totalfees = mnthcharge + ( numchecks * mt60); } else { // invalid number of checks } printf("Total fees due for %d checks: %.2f",numchecks,totalfees); return 0; }
Join our real-time social learning platform and learn together with your friends!