Menu

(Solved) : Fix Code C Language Please Include Include Include Include Char Menu Char Transactionmenu Q37279257 . . .

fix the code C Language please

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
char menu();
char transaction_menu();
/* Verifies the Pin Entered match the PIN on record */
int validatePin(int);

/* Verifies the funds requested are available to perfrom thetransaction
* 0 – Ok to perform transaction, 1 – funds not available
*/
int verify(double, double);

/* Each of the following routines should update a specificbalance
* after the transaction has been completed
*/
double chk_deposit(double currentBalance, double amount);
double chk_withdraw(double currentBalance, double amount);
double sav_deposit(double bacurrentBalancel, double amount);
double sav_withdraw(double currentBalance, double amount);
void transfer(double, double);
double chk_deposit(double currentBalance, double amount)
{
currentBalance = currentBalance + amount;
return currentBalance;
}
double chk_withdraw(double currentBalance, double amount)
{
currentBalance = currentBalance – amount;
return currentBalance;
}
double sav_deposit(double currentBalance, double amount)
{
currentBalance = currentBalance + amount;
return currentBalance;
}
double sav_withdraw(double currentBalance, double amount)
{
currentBalance = currentBalance – amount;
return currentBalance;
}
int validatePin(int pin){
int entered_pin =0;
printf(“Enter PIN “);
scanf(“%d”, &entered_pin);
return entered_pin != pin;
}
char transaction_menu(){
char c;
printf(“S – SAVINGttC – CHECKINGn”);
printf(“Enter Choice:”);
scanf(” %c”, &c);
if (c == ‘S’ || c == ‘s’){
return ‘S’;
}
else{
return ‘C’;
}
}
char menu(){
char c;
printf(“———————– MENU——————–n”);
printf(“C – CHECK BALANCEttD – DEPOISTn”);
printf(“T – TRANSFERtttW – WITHDRAWn”);
printf(“Y – ANOTHER TRANSACTIONttE – ENDn”);
printf(“Enter Choice:”);
scanf(” %c”, &c);
return c;
}
int main()
{
char choice, t_choice;
srand(time(NULL));
int pin = rand() % 9999;
int acct_num = rand() % 99999;
double chk_acct_bal = rand() % 99999;
double sav_acct_bal = rand() % 99999;
printf(“PIN: %dn”, pin);
printf(“Account#: %dn”, acct_num);
printf(“Checking Balance: %.2fn”, chk_acct_bal);
printf(“Saving Balance: %.2fn”, sav_acct_bal);
if ( validatePin(pin) == 1){
printf(“Oops you messed up….”);
return 1;
}
while(choice != ‘E’)
{
choice = menu();
printf(“Choice: %cn”, choice);
if (choice == ‘E’)
{
printf(“Have a nice day, bye.”);
return 0;
}
if (choice == ‘D’ || choice == ‘W’)
{
t_choice = transaction_menu();
printf(“Transaction Choice: %cn”, t_choice);
if(choice == ‘D’)
{
if(t_choice == ‘S’ || t_choice == ‘s’)
{
double A;
printf(“Enter amount n”);
scanf(“%lf”,&A);
sav_acct_bal = sav_deposit(sav_acct_bal,A);
}
else if(t_choice == ‘C’ || t_choice == ‘c’)
{
double A;
printf(“Enter amount n”);
scanf(“%lf”,&A);
chk_acct_bal = chk_deposit(sav_acct_bal,A);
}
}
else if(choice == ‘W’)
{
if(t_choice == ‘S’ || t_choice == ‘s’)
{
double A;
printf(“Enter amount n”);
scanf(“%lf”,&A);
if(verify(sav_acct_bal,A))
{
sav_acct_bal = sav_withdraw(sav_acct_bal,A);
}
else
{
printf(“Balance is less!n”);
}
}
else if(t_choice == ‘C’ || t_choice == ‘c’)
{
double A;
printf(“Enter amount n”);
scanf(“%lf”,&A);
if(verify(sav_acct_bal,A))
{
chk_acct_bal = chk_withdraw(sav_acct_bal,A);
}
else
{
printf(“Balance is less!n”);
}
}
}
}
if(choice == ‘C’)
{
char t_choice = transaction_menu();
if(t_choice == ‘S’)
{
printf(“Balance: %lfn”,sav_acct_bal );
}
else
{
printf(“Balance: %lfn”,chk_acct_bal );
}
}
if (choice == ‘T’){
printf(“Transfer: %cn”, choice);
}
if (choice == ‘Y’){
printf(“Transfer: %cn”, choice);
}
}
return 0;
}

Expert Answer


Answer to fix the code C Language please #include #include #include #include char menu(); char transaction_menu(); /* Verifies the…

OR