Hello, I need some help with the program below.
#include <stdio.h>
float get_startingbalance(void);
float getCntOfWithdrawls();
float getCntOfDeposits();
float getEachDeposit();
float getEachWithdrawl();
float checkBalance();
float calcAndDisplayBalance();
float displayBankRecord();
void print_withdrawalnumber(int num_withdrawals);
void print_depositnumbers(int num_deposits);
void print_startingbalance(float start_balance);
void print_endbalance(float current_balance);
int main()
{
/* Declare Variables */
int num_withdrawals, num_deposits, x;
float deposits[50] = {0.0};
float withdrawals[50] = {0.0};
float current_balance = {0.0};
float start_balance = {0.0};
char first_name[20];
/* Output initial greeting */
printf("Welcome to the Sears Banking System.\n");
printf("Please enter your first name: ");
scanf("%s", first_name);
fflush(stdin);
printf("\nHello, %s\n\n", first_name);
/* Prompt user for current balance. */
start_balance = get_startingbalance();
printf("You entered %.2f ", start_balance);
getchar();
} /* end main */
/*START FUNCTION GET STARTING BALANCE*/
float get_startingbalance()
{
float start_bal;
do
{
printf("Please enter your current balance in dollars and cents: ");
scanf("%f", &start_bal);
fflush(stdin);
if(start_bal < 0)
printf("Invalid entry. Starting balance must be at least zero!\n\n");
}while(start_bal < 0); /*END DO WHILE*/
return start_bal;
} /* end function get starting balance */
/*START FUNCTION GET NUMBER OF WITHDRAWLS*/
float getCntOfWithdrawals()
{
float num_withdrawals;
do
{
printf ("\nEnter the number of withdrawals: ");
scanf ("%d",&num_withdrawals);
fflush(stdin);
if (num_withdrawals < 0 || num_withdrawals > 50)
printf ("Error: Number of withdrawals must be between zero and 50, please re-enter!\n\n");
} while (num_withdrawals < 0 || num_withdrawals > 50); /* end do-while trap loop */
return num_withdrawals;
}/* end function number of withdrawls */
/*START FUNCTION GET NUMBER OF DEPOSITS*/
float getCntOfDeposits()
{
float num_deposits
do
{
printf ("\nEnter the number of deposits: ");
scanf ("%i",&num_deposits);
fflush(stdin);
if ( num_deposits < 0 || num_deposits > 50)
printf ("Error: Number of deposits must be between 0 and 50, please re-enter!\n\n");
}while (num_deposits < 0 || num_deposits > 50); /* end do-while trap loop */
return num_deposits;
}/* end function number of deposits */
/*START FUNCTION GET EACH DEPOSIT*/
float getEachDeposit()
{
float num_deposits
for (x = 1; x <= num_deposits; x++)
{
do
{
printf ("Enter the amount of deposit #%i: ", x);
scanf ("%f",&deposits[x]);
fflush(stdin);
if (deposits[x] <= 0)
printf ("*** Deposit amount must be greater than zero. Please re-enter! ***\n");
} while (deposits[x] <= 0);
total_deposits = total_deposits + deposits[x];
}/*end for loop*/
/*end function get each deposit*/
/*START FUNCTION GET EACH WITHDRAWL*/
float getEachWithdrawl()
{
float num_withdrawls
for (x = 1; x <= num_withdrawals; x++)
{
do
{
printf ("Enter the amount of withdrawal #%i: ", x);
scanf ("%f",&withdrawals[x]);
fflush(stdin);
if (withdrawals[x] > current_balance)
printf ("***Withdrawal amount exceeds current balance.***\n");
else
if (withdrawals[x] <= 0)
printf ("*** Withdrawal amout must be greater than zero. Please re-enter! ***");
} while (withdrawals[x] > current_balance || withdrawals[x] <= 0); /* end do-while loop */
total_withdrawals = total_withdrawals + withdrawals[x];
/*end function get each withdrawl*/
/*START FUNCTION CHECK BALANCE*/
float checkBalance();
{
float current_balance
balance = current_balance - total_withdrawals + total_deposits;
if (balance == 0)
{
printf ("\n *** Balance is now zero. No more withdrawals can be made at this time. ***\n");
num_withdrawals = x;
break;
} /*end-if*/
} /*end for loop*/
/*end function check balance*/
/*START FUNCTION CALC AND DISPLAY BALANCE*/
float calcAndDisplayBalance()
{
printf ("\n*** Your closing balance is $%.2f, %s*** \n", balance, first_name);
if (balance >= 5000.00)
printf ("*** Time to invest some money!*** \n\n");
else if (balance >= 15000.00 && balance <= 49999.99)
printf ("*** Maybe you should consider a CD.*** \n\n");
else if (balance >= 1000.00 && balance <= 14999.99)
printf ("*** Keep up the good work.*** \n\n");
else
printf ("*** %s, your balance is getting low!*** \n\n", first_name);
}/*end-if*/
/*end function calc and display balance*/
/*START FUNCTION DISPLAY BANK RECORD*/
float displayBankRecord()
printf (" *** Bank Record ***\n");
printf ("\nStarting Balance:$ %13.2f\n\n", current_balance);
for (x = 1; x <= number_of_deposits; x++)
{
printf ("Deposit #%i: %13.2f\n", x, deposits[x]);
}
for (x = 1; x <= number_of_withdrawals; x++)
{
printf ("\nWithdrawal #%i: %13.2f", x, withdrawals[x]);
}
printf ("\n\nEnding Balance is:$ %13.2f\n", balance);
/*end function display bank record*/
The program is supposed to use functions to perform some simple banking transactions. I am pretty new to programming and I am hoping someone can point me in the right direction. Thanks in advance.