Skip to content

"eBank" is a simple C++ project designed as a simple Internet Banking application.

License

Notifications You must be signed in to change notification settings

AlexandruR17/ebank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

eBank

"eBank" is a simple C++ project designed as a simple Internet Banking application.
It is not linked to a database or made with a real purpose, it is made as an experiment.

Functions

  1. Sign up
    When you start the program, you will be required to register using a 6-digit pin. image
int pin_signup(){
    int pinsup = 0;
    std::cout << "Welcome to eBank! Please enter a 6-Digit PIN for registration: ";
    std::cin >> pinsup;
    while (checkdigit(pinsup) != 6){
        std::cout << "You have not entered a 6-digit PIN. \n" ; 
        std::cout << "Please enter a 6-Digit PIN for registration: ";
        std::cin >> pinsup;
    }
    std::cout << "Congratulations! You have successfully created your eBank account! \n";
    return pinsup;
}

image
Checking the number of digits is done with:

int checkdigit(int pin){
    return int(log10(pin) + 1);
}
  1. Sign in
    The connection to the "application" will be made using the pin with which the user registered.
    image
bool pin_login(int pin){
    int pinlogin = 0, k = 3;
    std::cout << "Please enter your PIN:";
    while (k){
    std::cin >> pinlogin;
    if (pinlogin == pin){
        std::cout << "You have successfully logged in!\n";
        return true;
    }
    else{
        std::cout << "The pin is incorrect. You have " << k-1 << " more attempts:";
        k--;
    }
    }
        std::cout << "\n";
        std::cout << "The account has been blocked! Please contact a bank representative for more information.";
        return false;
}

image

  1. The main menu of the application
    image
void choicemessage(){
    int choice = 0;
    std::cout << "*******************\n";
    std::cout << "Enter your choice:\n";
    std::cout << "*******************\n";
    std::cout << "1. Show balance\n";
    std::cout << "2. Deposit money\n";
    std::cout << "3. Withdraw money\n";
    std::cout << "4. Transfer money\n";
    std::cout << "5. Exit\n";
}

void in_choice(int choice, double balance){
    switch(choice){
        case 1: showBalance(balance);
                break;
        case 2: deposit(balance);
                break;
        case 3: withdraw(balance);
                break;
        case 4: sendmoney(balance);
                break;
    }
}
  1. Show Balance
    This function is capable of showing the sum that the user has in the application. image
void showBalance(double balance){
    std::cout << "Your balance is: " << balance << "\n";
    Anotheroperation(balance);
    
}
  1. Deposit money
    This function allows you to deposit less than 100000e.
    image
void withdraw(double balance){
    int amount = 0;
    std::cout << "Enter amount to be withdrawn: ";
    std::cin >> amount;
    if (amount > 100000)
        std::cout << "For security reasons, you cannot withdraw an amount greater than or equal to 100000€ in a signle operation.\n";
    else if (amount < balance)
        {
            balance -= amount;
            std::cout << "You have successfully withdrawn " << amount << "\n";
        }
    else
    std::cout << "Insufficient funds.\n";
        
    Anotheroperation(balance);
}

image

  1. Withdraw money
    You can withdraw an amount of money from your current account.
    For "security" reasons, you cannot withdraw an amount greater than or equal to 100000€ in a single operation. image
void withdraw(double balance){
    int amount = 0;
    std::cout << "Enter amount to be withdrawn: ";
    std::cin >> amount;
    if (amount > 100000)
        std::cout << "For security reasons, you cannot withdraw an amount greater than or equal to 100000€ in a single operation.\n";
    else if (amount < balance)
        {
            balance -= amount;
            std::cout << "You have successfully withdrawn " << amount << "\n";
        }
    else
    std::cout << "Insufficient funds.\n";
        
    Anotheroperation(balance);
}
  1. Transfer money
    7.1. Manual Transfer - function that allows you to transfer an amount of money to an IBAN of your choice (iban.length() == 24) image
void manualtransfer(double balance){
    std::string iban; // ex = "RO49AAAA1B31007593840000";
    int amount, choice;
    std::cout << "IBAN:";
    std::cin >> iban;
    if (iban.length() == 24){ //RO 24
    std::cout << "Amount:";
    std::cin >> amount;
    if (balance >= amount){
    std::cout << "Your new balance will be " << balance-amount << "€. Is that okay? (0 = no, 1 = yes) ";
    std::cin >> choice;
    if (choice == 1){
        balance = balance-amount;
        std:: cout << "Thank you for the transaction.";
    }
        
    }
    else {
    std:: cout << "Insufficient funds.\n";

     }
    }
    else{
        std::cout << "IBAN is incorrect.";
    }
    Anotheroperation(balance);
}

7.2. Pay bills - the function allows you to pay an invoice/insurance/others without entering the IBAN
image

void bills(double balance, int choice_1, int choice){
    int amount;
    std::string details, series;
    if (choice_1 == 1){
     std::cout << "Amount:";
     std::cin >> amount;
    if (amount > balance && amount > 0){
        std::cout << "Insufficient funds.\n";
        Anotheroperation(balance);
    }
    else {
        std::cout << "Details of the transfer:";
        std::cin >> details;
        std::cout << "Series and policy number:";
        std::cin >> series;
        
        }
       companies_database(choice, choice_1); 
       std::cout << "Amount: " << amount << "\n";
       std::cout << "Total amount in account currency (including commissions): " << amount-(rand()%2+1) << "\n";
       std::cout << "Execution date: ";
       amount < 1000 ? std::cout << "As soon as possible\n" : std:: cout << "Up to 5 business days\n";
       std::cout << "Details of the transfer:";
       std::cout << details << "\n";
       std::cout << "Series and policy number:";
       std::cout << series << "\n";
       int op;
       std::cout << "Is that okay? (0 = no, 1 = yes)\n";
       std::cin >> op;
       if (op){
           if (std::cin.get() == '\n')
           balance-=amount;
           std::cout << "Thank you for the transaction.";
       }
       Anotheroperation(balance);
    }
    

}

WIP...

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

"eBank" is a simple C++ project designed as a simple Internet Banking application.

Topics

Resources

License

Stars

Watchers

Forks

Languages