Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are required to develop a simplified banking system in which a customer can

ID: 3553147 • Letter: Y

Question

You are required to develop a simplified banking system in which a customer can deposit cash to

a checking account, withdraw cash from the account, query the balance of an account, or transfer

funds from one account to another. A transaction is initiated when a customer enter an account

number (5 digits) and a user-entered PIN (4 digit personal identification number) into the system.

The customer is allowed three attempts to enter the correct account number and PIN; the account

number is locked if the third attempt fails.

If the PIN is validated satisfactorily, the customer is prompted for a withdrawal, deposit,

query, transfer, or cancel transaction. Before a withdrawal transaction can be approved, the

system determines that sufficient funds exist in the requested account. If the transaction is

approved, the requested amount of cash is reduced (dispensed). Before a transfer transaction can

be approved, the system determines that the customer has at least two accounts and that there are

sufficient funds in the account to be debited. A bank staff can open and close an account with

customer PIN, SSN, and zero balance, and the system creates an account number.

Explanation / Answer


Formatted code :
http://ideone.com/5qkzVD


----------------------------------------------------------------



#include<stdio.h>


int acc_number = 10000 ;


typedef struct Details

{

int PIN ;

int balance ;

long int SSN ;

int flag ;

};


struct Details account[1000000];

void init()

{

int i ;

for(i = 10000 ; i < 1000000 ;i++)

account[i].flag = 0 ;

}


int digs(int num)

{

int cnt = 0 ;

while(num)

num/=10,cnt++;

return cnt;

}

void Menu()

{

printf("OPTIONS: ");

printf("1. Cash Deposit ");

printf("2. Cash withdrawl ");

printf("3. Account information ");

printf("4. Transfer ");

}


void BankStaff(int PIN , long int SSN)

{

account[acc_number].PIN = PIN ;

account[acc_number].SSN = SSN ;

account[acc_number].balance = 0 ;

account[acc_number].flag = 1 ;


acc_number++;

}


void Customer()

{

int flag = 1 ;

int cnt = 0 ;

int ACC_NO , PIN ;

do{


printf("Enter ACC_NO & PIN ");

scanf("%d%d",&ACC_NO,&PIN);

cnt++ ;

if(digs(ACC_NO) != 5 || digs(PIN) != 4)

{

flag = 0 ;

printf("Enter correctly ");

}

if(account[ACC_NO].flag != 1 || account[ACC_NO].PIN != PIN)

{

flag = 0 ;

printf("Enter correctly ");

}

} while( cnt <= 3 && !flag );



Menu();

int choice ;

scanf("%d",&choice);

int val ;

switch(choice)

{

   case 1 :

   printf("Enter the amount you need to deposit : ");

   scanf("%d",&val);

   account[ACC_NO].balance = account[ACC_NO].balance + val ;

   break;


   case 2 :

   printf("Enter the amount to withdraw:");

   scanf("%d",&val);

   if( val > account[ACC_NO].balance )

   printf("NOT Sufficient funds ");

   else

   account[ACC_NO].balance = account[ACC_NO].balance - val ;

   break ;


   case 3 :

   printf("Account Information: ") ;

   printf("%d ",account[ACC_NO].balance);

   break ;


   //printf("")


   case 4 :

   printf("Enter account number to send money: ");

   int ac_s ;

   scanf("%d",&ac_s);

   printf("Enter account number to debit money: ");

   int ac_d ;

   scanf("%d",&ac_d);


   if(account[ac_d].flag != 1 || account[ac_s].flag != 1 )

   printf("Account Does not exist!");

   else

   {

  

   printf("Enter amount to transfer: ");

   scanf("%d",&val);


   if(account[ac_d].balance < val )

   printf("NOT Sufficient funds ");

   else

   {

   account[ac_s].balance += val ;

   account[ac_d].balance -= val ;

   }


   }

   break ;


   default: printf("Enter correct choice");






}




}


int main()

{

return 0 ;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote