Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include //structure of Account typedef struct BankAccount { char bankName[20]; char bankBranch[20]; char accountHolderName[30]; int accountNumber; char address[50]; long balance; }Account; //function prototypes Account createAccount();

image text in transcribed

#include

//structure of Account typedef struct BankAccount { char bankName[20]; char bankBranch[20]; char accountHolderName[30]; int accountNumber; char address[50]; long balance; }Account;

//function prototypes Account createAccount(); void deposit(Account[]); void withdraw(Account[]); void displayAccountInfo(Account[]); int displayMenu();

//main function int main() { //variable declaration int op, choice; Account acc[10], tacc;

do{ //display the menu op = displayMenu();

if(op == 5) break; if(op == 1) { //create an account tacc = createAccount(); //store onto the array acc[tacc.accountNumber-1] = tacc; } else if(op == 2) //deposit money deposit(acc); else if(op == 3) //withdraw money withdraw(acc); else if(op == 4) //display account information displayAccountInfo(acc); printf(" Please enter 1 to go main menu or 0 to exit the program: "); scanf("%d", &choice); }while(choice!=0); printf("Exit Program.......... "); }

//function to create an account Account createAccount() { Account acc; getchar(); //read the account information printf(" Enter the bank name :"); fgets(acc.bankName, 20, stdin); printf("Enter the bank branch :"); fgets(acc.bankBranch, 20, stdin); printf("Enter the account holder name :"); fgets(acc.accountHolderName, 30, stdin); printf("Please Enter the account number(1 to 10): "); scanf("%d", &acc.accountNumber); getchar(); printf("Enter the account holder address :"); fgets(acc.address, 50, stdin); acc.balance = 0;

printf(" Account has been created successfully "); //display account information printf("Bank name : %s", acc.bankName); printf("Bank branch : %s", acc.bankBranch); printf("Account holder name : %s", acc.accountHolderName); printf("Account number : %d ", acc.accountNumber); printf("Account holder address : %s", acc.address); printf("Available balance: %ld VND ", acc.balance);

return acc; }

//function to deposit money void deposit(Account acc[]) { int amount, accNum; printf("Enter account number you want to deposit money: "); scanf("%d", &accNum); printf("The current balance for %d account is %ld VND ", accNum, acc[accNum-1].balance); printf("Enter money you want to deposit: "); scanf("%d", &amount); acc[accNum-1].balance += amount; printf("The New balance for %d account is %ld VND ", accNum, acc[accNum-1].balance); }

//function to withdraw money from account void withdraw(Account acc[]) { int amount, accNum; printf("Enter account number you want to withdraw money: "); scanf("%d", &accNum); printf("The current balance for %d account is %ld VND ", accNum, acc[accNum-1].balance); printf("Enter money you want to withdraw from account: "); scanf("%d", &amount); acc[accNum-1].balance -= amount; printf("The New balance for %d account is %ld VND ", accNum, acc[accNum-1].balance); }

//function to display menu int displayMenu() { int n; printf(" ***** Bank Management System ***** "); printf("1. Create new account "); printf("2. Cash Deposit "); printf("3. Cash withdrawal "); printf("4. Account information "); printf("5. Exit "); printf("========================= "); printf("Please enter any options(1->5) to continue: "); scanf("%d", &n); return n; }

//function to display account information void displayAccountInfo(Account acc[]) { int accNum; printf("Enter account number you want to show information: "); scanf("%d", &accNum);

printf("Bank name : %s", acc[accNum-1].bankName); printf("Bank branch : %s", acc[accNum-1].bankBranch); printf("Account holder name : %s", acc[accNum-1].accountHolderName); printf("Account number : %d ", acc[accNum-1].accountNumber); printf("Account holder address : %s", acc[accNum-1].address); printf("Available balance: %d VND ", acc[accNum-1].balance); }

Format of Project Report Students need to follow strictly the SEE report format. Some main parts should include in your report as follows: Introduction (Problem statement, Motivation) Approach/ Background (you should clearly explain information including some theories, fundamentals, algorithms, block diagram, ...) Results and Discussion (trying different cases and gives some comments) . Conclusion Task Assignment (A part listing tasks performed in the project by each team member of individual tasks). . Reference

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

What is the use of bootstrap program?

Answered: 1 week ago

Question

What is a process and process table?

Answered: 1 week ago

Question

What is Industrial Economics and Theory of Firm?

Answered: 1 week ago

Question

The Functions of Language Problems with Language

Answered: 1 week ago

Question

The Nature of Language

Answered: 1 week ago