Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- using namespace std;
- class account {
- private:
- double acc_ID;
- double acc_balance;
- private:
- string acc_type, acc_Date = " 25/4/2018";
- public:
- account() : acc_ID(0), acc_balance(0){};
- account(double acc_num)
- {
- acc_ID = acc_num;
- acc_balance = 15000;
- }
- void set_acc_info()
- {
- cout << " Enter Your acc_ID " << endl;
- cin >> acc_ID;
- cout << " Enter Your new Balance : " << endl;
- cin >> acc_balance;
- cout << " What is the type of Account " << endl;
- cin >> acc_type;
- cout << " your account was Created " << acc_Date << endl;
- }
- virtual double Show_acc_balance(account a)
- {
- return a.acc_balance;
- }
- virtual double Show_acc_balance(double amount)
- {
- if (amount > this->acc_balance) {
- cout << "Error: Deducted amount is greater than account balance" << endl;
- return NULL;
- }
- return this ->acc_balance -= amount;
- }
- };
- class branch : public account
- {
- private:
- string Branch_name = "Helwan", Branch_address=" street Ahmed Latef";
- int Branch_ID = 5595-44440-41721-5555, acc_ID, count = 0;
- public:
- void Get_acc_Data(int accc_id)
- {
- account *client[100];
- acc_ID = accc_id;
- client[count] = new account (acc_ID);
- client[count]->Show_acc_balance(acc_ID);
- }
- void transfer()
- {
- int transfer_acc_ID, transfer_amount;
- cout << "Enter ACC ID that you want to transfer" << endl;
- cin >> transfer_acc_ID;
- cout << "Enter amount that you want to tranfer" << endl;
- cin >> transfer_amount;
- }
- void Deposite()
- {
- int Deposite_acc_ID, Deposite_amount;
- cout << "Enter ACC ID to Deposite on it" << endl;
- cin >> Deposite_acc_ID;
- account access_account;
- cout << " Avaliable : " << access_account.Show_acc_balance(Deposite_acc_ID) << endl;
- cout << "Enter Amount that you want to Deposite " <<endl;
- cin >> Deposite_amount;
- }
- };
- class ATM :public branch
- {
- public:
- double Card_num,accc_ID, n = 0;
- void Get_Debit_card_Data()
- {
- cout << "Please Enter you Card num " << endl;
- cin >> Card_num;
- cout << " \n " << endl;
- cout << "please Enter Your account id " << endl;
- cin >> accc_ID;
- cout << " \n " << endl;
- }
- account access_account;
- void balance_inquiry()
- {
- cout << "\n 'EGP Balance inquiry' " << endl;
- cout << " Account : \n" << setw(18) << accc_ID << endl;
- cout << " \n" << " Current Available : " << access_account.Show_acc_balance(access_account) << setw(5) << " EGP" << endl;
- cout << "\n Thank You For Using ATM CASH 24 Services " << endl;
- cout << " 1/5/2018" << setw(22) << " 1:58:18 A.M" << endl;
- //cout << "Your Balance is : " << endl;
- }
- void withdrawl()
- {
- account access_account(accc_ID);
- double withdrawl_amount;
- cout << "Please Enter withdrawl Amount : " << endl;
- cin >> withdrawl_amount;
- cout << " \n " << endl;
- cout << " \n " << endl;
- cout << "Card : " << Card_num << endl;
- cout << "\n 'EGP Withdrawl' " << endl;
- cout << " Account : \n" << setw(18) << accc_ID << endl;
- cout << " \n" << " Current Available : " << access_account.Show_acc_balance(access_account) << setw(5) << " EGP" << endl;
- cout << " \n" << " Amount : " << withdrawl_amount << setw(5) << " EGP" << endl;
- cout << " \n" << " Available After withdrawl : " << access_account.Show_acc_balance(withdrawl_amount) << setw(5) << " EGP" << endl;
- cout << access_account.Show_acc_balance(access_account) << endl;
- cout << "\n Thank You For Using ATM CASH 24 Services " << endl;
- cout << " 1/5/2018" << setw(22) << " 1:58:18 A.M" << endl;
- }
- };
- class client : public ATM
- {
- int client_ID, client_phone_No;
- string client_name, client_address;
- };
- int main(){
- client c1;
- c1.Get_Debit_card_Data();
- c1.balance_inquiry();
- cout << "\n \n \n " << endl;
- c1.withdrawl();
- cout << "\n \n \n " << endl;
- c1.balance_inquiry();
- // c1.Deposite();
- cout << "\n \n \n " << endl;
- // c1.transfer();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement