learning from the course to build something substantial Project: A bank is build
ID: 3823936 • Letter: L
Question
learning from the course to build something substantial Project: A bank is building a new software in C. The requirements for this software are the following: account and a customer account. To start off the administrator account user must be "admin" (login), admin (password) The login screen should allow both administrator and Customer to login to the system Welcome to Online Banking/ATM System Enter your Customer Admin ID: 12345 OR admin Enter your Customer/Admin Password: XXXXX OR admin The administrator shall be able to login to the system. The system should detect when an administrator has logged in. Once logged in shelhe shall be able to see a menu as shown below Welcome to Online Banking/ATM System Administrator Menu Create Customer account 2 Change Password View Customer Info 4 Change Customer Info so Delete Customer account 6 Show Top 5 accounts Show customer accounts alphabetically 8) ExitExplanation / Answer
Solution :
// Headeer files
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
// declaration of structure
struct account-type
{
char bank-name[16];
char bank-branch[20];
char account-holder-name[30];
int account-number;
char account-holder-address[100];
float available-balance;
};
struct account-type account[20];
int num_account;
void Create-new-account();
void Cash-Deposit();
void Cash-withdrawl();
void Account-information();
void Log-out();
void display-options();
// main function of the program
int main()
{
char user-Option;
num_account=0;
while(1)
{
printf(" ***** Customer details ***** ");
display-options();
printf("Please enter the any options aas per your requirement (1/2/3/4/5/6) ");
printf("to be continue : ");
user-Option = getch();
printf("%c ", user-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 from 1 to 6");
printf("(1/2/3/4/5/6) to be continue ");
break;
}
}
return 0;
}
// Function to display the available options in the customer
void display-options()
{
printf(" 1. Create the new-account ");
printf("2. Cash-Deposit ");
printf("3. Cash-withdrawl ");
printf("4. Account-information ");
printf("5. Log-out ");
printf("6. Clear the screen & display available ");
printf("options ");
}
// Function to create the new account
void Create-new-account()
{
char bank-name[20];
char bank-branch[20];
char account-holder-name[30];
int account-number;
char account-holder-address[100];
float available-balance = 0;
fflush(stdin);
printf(" Enter the name of the bank : ");
scanf("%s", &bank-name);
printf(" Enter the branch of the bank : ");
scanf("%s", &bank-branch);
printf(" Enter the name of the account holder : ");
scanf("%s", &account-holder-name);
printf(" Enter account number(1 to 10): ");
scanf("%d", &account-number);
printf(" Enter the address of the account holder : ");
scanf("%s", &account-holder-address);
strcpy(account[account-number-1].bank-name,bank-name);
strcpy(account[account-number-1].bank-branch,bank-branch);
strcpy(account[account-number-1].account-holder-name,
account-holder-name);
account[account-number-1].account-number=account-number;
strcpy(account[account-number-1].account-holder-address,
account-holder-address);
account[account-number-1].available-balance=available-balance;
printf(" your account has been created successfully ");
printf("name of the bank : %s " ,
account[account-number-1].bank-name);
printf("Bank branch : %s " ,
account[account-number-1].bank-branch);
printf("Account holder name : %s " ,
account[account-number-1].account-holder-name);
printf("Account number : %d " ,
account[account-number-1].account-number);
printf("Account holder address : %s " ,
account[account-number-1].account-holder-address);
printf("Available balance : %f " ,
account[account-number-1].available-balance);
}
// function for display the account informations
void Account-information()
{
register int number-account = 0;
//if (!strcmp(customer,account[count].name))
while(strlen(account[number-account].bank-name)>0)
{
printf(" name of the bank : %s " ,
account[number-account].bank-name);
printf("Bank branch : %s " ,
account[number-account].bank-branch);
printf("Account holder name : %s " ,
account[number-account].account-holder-name);
printf("Account number : %d " ,
account[number-account].account-number);
printf("Account holder address : %s " ,
account[number-account].account-holder-address);
printf("Available balance : %f " ,
account[number-account].available-balance);
num-acc++;
}
}
// Function to deposit the amount in an account
void Cash-Deposit()
{
auto int account-no;
float add-money;
printf("Enter the account number you want to deposit the money:");
scanf("%d",&account-no);
printf(" The current balance for the account %d is %f ",
acc_no, account[account-no-1].available-balance);
printf(" Enter the money you want to deposit : ");
scanf("%f",&add-money);
while (acc_no=account[acc_no-1].acc_number)
{
account[account-no-1].available-balance=
account[account-no-1].available-balance+add-money;
printf(" New balance for the account %d is %f ",
account-no, account[account-no-1].available-balance);
break;
}acc-no++;
}
// Function to withdraw the amount from an account
void Cash-withdrawl()
{
auto int account-no;
float withdraw-money;
printf("Enter the account number you want to withdraw money:");
scanf("%d",&account-no);
printf(" current balance for the account %d is %f ",
acc_no, account[account-no-1].available-balance);
printf(" Enter the money you want to withdraw from account ");
scanf("%f",&withdraw-money);
while (account-no=account[account-no-1].account-number)
{
account[account-no-1].available-balance=
account[account-no-1].available-balance-withdraw-money;
printf(" New balance for account %d is %f ",
account-no, account[account-no-1].available-balance);
break;
}
acc-no++;
}
/// ** Thank You ** ///
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.