Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (itiaax):

Can you tell me what's wrong with this code? The compiler keeps saying [Error] too few arguments to function 'float calcNewBal(float, float)'

OpenStudy (itiaax):

#include <stdio.h> #include <conio.h> float calcNewBal(float, float); float calcRunningBal(float, float); float calcTaxDue(float, float); float calcEomBal(float, float); int main() { float newBal, runningBal, taxDue, eomBal; newBal = calcNewBal(newBal); runningBal = calcRunningBal(runningBal); taxDue = calcTaxDue(taxDue); eomBal = calcEomBal(eomBal); return 0; }/*End main function*/ /*Function to calculate new balance*/ float calcNewBal(float startingBal, float totWithdrawl) { /*Local variable declaration*/ float newBal; printf("Enter customer's starting balance and total withdrawls "); scanf("%f%f", &startingBal, &totWithdrawl); newBal = startingBal - totWithdrawl; return newBal; }/*End function to calculate new balance*/ /*Function to calculate running balance*/ float calcRunningBal(float newBal, float totDeposit) { /*Local varibale declaration*/ float runningBal; printf("Enter customer's new balance and total deposit: "); scanf("%f%f", &newBal, &totDeposit); runningBal = newBal + totDeposit; return runningBal; }/*End function to calculate running balance*/ /*Function to calculate tax due*/ float calcTaxDue(float totDeposit, float totWithdrawl) { /*Local variable declaration*/ float taxDue; printf("Enter customer's total withdrawl and total deposit:"); scanf("%f%f", &totDeposit, &totWithdrawl); taxDue = (totDeposit + totWithdrawl) * 0.1; return taxDue; }/*End function to calculate tax due*/ /*Function to calculate end of month balance*/ float calcEomBal(float runningBal, float taxDue) { /*Local variable declaration*/ float eomBal; printf("Enter customer's running balance and tax due: "); scanf("%f%f", &runningBal, &taxDue); eomBal = runningBal - taxDue; return eomBal; }/*End function to calculate end of month balance*/

OpenStudy (anonymous):

`float calcNewBal(float, float);` says there are two args `newBal = calcNewBal(newBal);` only one given in call

OpenStudy (itiaax):

So then how should I correct this?

OpenStudy (anonymous):

Need to put `calcNewBal(newBal, variable);` where `variable` is whatever `totWithdrawal` is supposed to be. Did you write this code?

OpenStudy (itiaax):

Thank you! Yes I did write this code.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!