0% found this document useful (0 votes)
7 views7 pages

Bank Ss - 025249

bank codeki

Uploaded by

Demark Roga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views7 pages

Bank Ss - 025249

bank codeki

Uploaded by

Demark Roga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

CC-102_FINAL-PROJECT

Comprehensive Banking
System Program

From: Demark Jade T. Roga


Submitted to: Dennis G. Corlet
#include <stdio.h>

// ini an function sa pag calculate sa interest based sa current balance


double calculate_interest(double balance, double interest_rate) {
double interest = balance * interest_rate * 1.0;
return interest;
}

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);

printf("Enter initial balance: ");


scanf("%lf", &balance);

// para sa banking system menu


do {
// displaying sa menu
printf("\nMenu:\n");
printf("1. Deposit Money\n");
printf("2. Withdraw Money\n");
printf("3. Check Balance\n");
printf("4. Calculate Interest\n");
printf("5. Exit\n");
printf("Choose an option: ");
scanf("%d", &choice);

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)

Display Menu Options

Choose Option
(Input)

Decision
(Option 1-
5)

Option 2: Option 3: Option 4:


Option 1:
Withdra Show Calculat
Deposit
w balance e
Interest

Repeat
or Exit

End

You might also like