I am writing a program in C to simulate a checking account. There are codes for transactions, I = Initial Balance, D = Deposit, and C = Check(you write a check to someone, like a withdrawal). There is a monthly fee of $3.00 to maintain the account, $0.06 fee for every check cashed, %0.03 for every deposit made, $5.00 overdraft fee whenever a check cashed brings the balance below $0.00.
I am having trouble completing the functions. If you don't think helping a bit with all of them is ok then please just help with the deposit() function. I am only a couple months into C and we just got into functions. Here is my unfinished code. Thanks for any help.
#include <stdio.h>
void outputHeaders (void);
void initialBalance (double iBalance);
void deposit(double amount, double balance, double service, int numDeposit,double amtDeposit);
void check(char code, double amtCheck, double balance);
void outputSummary ();
int main (void)
{
char code;
double amount, service, balance;
double amtCheck, amtDeposit, openBalance, closeBalance;
int numCheck, numDeposit;
amount = 0.0;
service = 0.0;
balance = 0.0;
amtCheck = 0.0;
amtDeposit = 0.0;
openBalance = 0.0;
closeBalance = 0.0;
numCheck = 0;
numDeposit = 0;
outputHeaders();
printf("Enter the code of transaction and the amount: ");
scanf("%c %lf\n", &code, &amount);
if (code == 'I')
{
initialBalance(amount, &balance, &service, &numDeposit, &amtDeposit);
}
else if (code == 'D')
{
deposit (amount, &balance, &service, &numDeposit);
}
else
{
check(amount, &balance, &service, &numCheck, &amtCheck);
}
getchar(); getchar();
return 0;
}
void outputHeaders (void)
{
printf("Transaction Deposit Check Balance\n"
"-------------- -------- ------ -------");
}
void initialBalance (double amount, double *balance, double *service, int *numDeposit, double *amtDeposit)
{
}
void deposit (double amount, double *balance, double *service, int *numDeposit, double *amtDeposit)
{
*balance = *balance + *amtDeposit;
*numDeposit++; //need to keep track of amount of deposits
*service = *service - 0.03; //service charge
printf("Deposit %lf %lf\n", *amtDeposit, *balance);
}
void check (double amount, double *balance, double *service, int *numCheck, double *amtCheck)
{
}
void outputSummary (int *numDeposit, double *amtDeposit, int *numCheck, int *amtCheck, double *openBalance, double *service, double *closeBalance)
{
}