Bank Ss - 025249
Bank Ss - 025249
Comprehensive Banking
System Program
int main() {
char name[50];
double balance, deposit, withdraw, interest_rate = 0.05;
int choice;
// an registration sa user
printf("Welcome to the Banking System!\n\n");
printf("Enter your name: ");
scanf("%s", name);
switch (choice) {
case 1:
// deposit sa money
printf("Enter amount to deposit: ");
scanf("%lf", &deposit);
if (deposit > 0) {
balance += deposit;
printf("Deposit successful! New balance: %.2lf\n", balance);
} else {
printf("Invalid amount to deposit.\n");
}
break;
case 2:
// withdraw sa money
printf("Enter amount to withdraw: ");
scanf("%lf", &withdraw);
if (withdraw > 0 && withdraw <= balance) {
balance -= withdraw;
printf("Withdrawal successful! New balance: %.2lf\n", balance);
} else if (withdraw > balance) {
printf("Insufficient balance for withdrawal.\n");
} else {
printf("Invalid amount to withdraw.\n");
}
break;
case 3:
// check sa balance
printf("Current balance: %.2lf\n", balance);
break;
case 4:
// calculate sa interest
{
double interest = calculate_interest(balance, interest_rate);
balance += interest;
printf("Interest earned: %.2lf\n", interest);
printf("New balance: %.2lf\n", balance);
}
break;
case 5:
// pag e exit an system
printf("Thank you for using the Banking System. Goodbye, %s Keep safe
always!\n", name);
break;
default:
printf("Invalid option. Please choose a valid option.\n");
break;
}
} while (choice != 5);
return 0;
}
Sample Output:
Welcome to the Banking System!
Enter your name: Demark
Enter initial balance: 1000.00
Menu:
1. Deposit Money
2. Withdraw Money
3. Check Balance
4. Calculate Interest
5. Exit
Choose an option: 1
Enter amount to deposit: 500.00
Deposit successful! New balance: 1500.00
Menu:
1. Deposit Money
2. Withdraw Money
3. Check Balance
4. Calculate Interest
5. Exit
Choose an option: 3
Current balance: 1500.00
Menu:
1. Deposit Money
2. Withdraw Money
3. Check Balance
4. Calculate Interest
5. Exit
Choose an option: 4
Interest earned: 75.00
New balance: 1575.00
Menu:
1. Deposit Money
2. Withdraw Money
3. Check Balance
4. Calculate Interest
5. Exit
Choose an option: 5
Thank you for using the Banking System. Goodbye, Demark keep safe always!
FLOWCHART
Start
Get User Info (Name &
Balance)
Choose Option
(Input)
Decision
(Option 1-
5)
Repeat
or Exit
End