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

Intro to Programming in C-Large Program 2-Bank simulation You will write a progr

ID: 3735519 • Letter: I

Question

Intro to Programming in C-Large Program 2-Bank simulation You will write a program that will simulate the management of money in 3 accounts checking, savings, and redit directive must be uscd to define a MAXCREDIT of-4s00 DO NOT declare any pointers for this assignment DO NOT use global variables NOT use break statements to stop loops Use function prototypes. Write comments for each function before each prototype and again before each function e Be sure to comment your code adequately. .Be sure to indent properly. definition how it should be donc Check the course textbook and lecture code examples to see Use meaningful variable names NOTE: To transfer between accounts, you need to make a withdraw Your starting bank balances should be as follows: followed by a deposit . o Checking: 480.45 Savings: o Credit: 124.62 -2134.78 You must have at least o user defined functions as follows a No modifications may be made to the functions idefine CRT SECURE NO WARNINGS rincludecstdio.h> #define MAXCREDIT -4500 isplays the list of options available l/pronpts for the user's selection and sets the value of the selection void RunBankChoices(int tchoicei l/greets the user void Greeting): /Takes one double argument and one characten argument void AccountBalance(double account, char letter) ays the current balance of the account (C checking, s savings, credit) //takes reference to all the bank account money val /Makes the decsion of which trnsaction should be done void the /takes a reference to the selected account balance gets the added amount from the user //takes a reference to the selected account //gets the withdrawal amount from the user //checks to see if there is enough money avail y from the account void WithdraMoney(double taccountPtr, chan letter);

Explanation / Answer

we take a structure to hold different data types

i hava made program to create multiple accounts more than 3 as many as needed and transactions are made posible only by deposit

deposition is done on created bank account .so make deposit after creating bank account

please run code to understand more preciesly

#include <stdio.h>

#include <conio.h>

#include <string.h>

#include <stdlib.h>

// Structure declaration

struct acc_type

{

     char bank_name[20];

     char bank_branch[20];

     char acc_holder_name[30];

     int acc_number;

     char acc_holder_address[100];

     float available_balance;    

};

struct acc_type account[20];

/*

     printf("The above structure can be declared using

     typedef like below");

     typedef struct acc_type

     {

        char bank_name[20];

        char bank_branch[20];

        char acc_holder_name[30];

        int acc_number;

        char acc_holder_address[100];

        float available_balance;    

     }Acc_detail;

     Acc_detail account[20];

*/

int num_acc;

void Create_new_account();

void Cash_Deposit();

void Cash_withdrawl();

void Account_information();

void Log_out();

void display_options();

/* main program */

int main()

{

    char option;

    char f2f[50] = "http://fresh2refresh.com/";

    num_acc=0;

    while(1)

    {

       printf(" ***** Welcome to Bank Application ***** ");

       printf(" This demo program is brought you by %s",f2f);

       display_options();

       printf("Please enter any options (1/2/3/4/5/6) ");

       printf("to continue : ");

        option = getch();

        printf("%c ", option);

        switch(option)

        {

          case '1': Create_new_account();

                    break;

          case '2': Cash_Deposit();

                    break;

          case '3': Cash_withdrawl();

                    break;

          case '4': Account_information();

                    break;

          case '5': return 0;

          case '6': system("cls");

                    break;

          default : system("cls");

                    printf("Please enter one of the options");

                    printf("(1/2/3/4/5/6) to continue ");

                    break;

        }

    }

    return 0;

}

/*Function to display available options in this application*/

void display_options()

{

    printf(" 1. Create new account ");

    printf("2. Cash Deposit ");

    printf("3. Cash withdrawl ");

    printf("4. Account information ");

    printf("5. Log out ");

    printf("6. Clear the screen and display available ");

    printf("options ");

}

/* Function to create new account */

void Create_new_account()

{

   char bank_name[20];

   char bank_branch[20];

   char acc_holder_name[30];

   int acc_number;

   char acc_holder_address[100];

   float available_balance = 0;

   fflush(stdin);    

   printf(" Enter the bank name              : ");

   scanf("%s", &bank_name);

   printf(" Enter the bank branch            : ");

   scanf("%s", &bank_branch);

   printf(" Enter the account holder name    : ");

   scanf("%s", &acc_holder_name);

   printf(" Enter the account number(1 to 10): ");

   scanf("%d", &acc_number);

   printf(" Enter the account holder address : ");

   scanf("%s", &acc_holder_address);

   strcpy(account[acc_number-1].bank_name,bank_name);

   strcpy(account[acc_number-1].bank_branch,bank_branch);

   strcpy(account[acc_number-1].acc_holder_name,

   acc_holder_name);

   account[acc_number-1].acc_number=acc_number;

   strcpy(account[acc_number-1].acc_holder_address,

   acc_holder_address);

   account[acc_number-1].available_balance=available_balance;

   printf(" Account has been created successfully ");

   printf("Bank name              : %s " ,

   account[acc_number-1].bank_name);

   printf("Bank branch            : %s " ,

   account[acc_number-1].bank_branch);

   printf("Account holder name    : %s " ,

   account[acc_number-1].acc_holder_name);

   printf("Account number         : %d " ,

   account[acc_number-1].acc_number);

   printf("Account holder address : %s " ,

   account[acc_number-1].acc_holder_address);

   printf("Available balance      : %f " ,

   account[acc_number-1].available_balance);

   //num_acc++;

}

// Displaying account informations

void Account_information()

{

     register int num_acc = 0;

     //if (!strcmp(customer,account[count].name))

     while(strlen(account[num_acc].bank_name)>0)

     {

         printf(" Bank name                : %s " ,

         account[num_acc].bank_name);

         printf("Bank branch              : %s " ,

         account[num_acc].bank_branch);

         printf("Account holder name      : %s " ,

         account[num_acc].acc_holder_name);

         printf("Account number           : %d " ,

         account[num_acc].acc_number);

         printf("Account holder address   : %s " ,

         account[num_acc].acc_holder_address);

         printf("Available balance        : %f " ,

         account[num_acc].available_balance);

         num_acc++;

     }

}

// Function to deposit amount in an account

void Cash_Deposit()

{

   auto int acc_no;

   float add_money;

   printf("Enter account number you want to deposit money:");

   scanf("%d",&acc_no);

   printf(" The current balance for account %d is %f ",

   acc_no, account[acc_no-1].available_balance);

   printf(" Enter money you want to deposit :  ");

   scanf("%f",&add_money);

   while (acc_no=account[acc_no-1].acc_number)

   {

         account[acc_no-1].available_balance=

         account[acc_no-1].available_balance+add_money;

         printf(" The New balance for account %d is %f ",

         acc_no, account[acc_no-1].available_balance);

         break;

   }acc_no++;

}

// Function to withdraw amount from an account

void Cash_withdrawl()

{

   auto int acc_no;

   float withdraw_money;

   printf("Enter account number you want to withdraw money:");

   scanf("%d",&acc_no);

   printf(" The current balance for account %d is %f ",

   acc_no, account[acc_no-1].available_balance);

   printf(" Enter money you want to withdraw from account ");

   scanf("%f",&withdraw_money);

   while (acc_no=account[acc_no-1].acc_number)

   {

         account[acc_no-1].available_balance=

         account[acc_no-1].available_balance-withdraw_money;

         printf(" The New balance for account %d is %f ",

         acc_no, account[acc_no-1].available_balance);

         break;

   }acc_no++;

}

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