Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- // Person mora imati Ime, prezime, oib
- // get imena, prezimena, oiba; privatni set imena, prezimena, oiba
- // Osoba neka ima instancu Account klase
- // BankAccount mora imati IBAN, balance
- // public get iban, balance; public withdraw, deposit, IBAN - inicijalizaciju u konstruktoru
- // Banka mora sadrzavati osobe i racune te mogucnost dodavanja istih
- // vector korisnika, mogucnost dodavanja novih korisnika, provjeru IBAN-a(ne smiju 2 ista biti)
- // Mogucnost pretrazivanja korisnika i printanje IBAN-a i trenutnog stanja racuna.
- // Zadatak:
- // napraviti program pomocu kojega korisnik moze dodavati nove klijente za banku
- // Mogucnost dodavanja i skidanja sredstava sa racuna
- // Program neka ima podrsku za dodavanje beskonacno mnogo klijenata.
- using namespace std;
- class BankAccount
- {
- public:
- BankAccount(string iban)
- {
- balance = 0.00f;
- }
- ~BankAccount() {};
- void withdraw(double ammount)
- {
- balance -= ammount;
- }
- void deposit(double ammount)
- {
- balance += ammount;
- }
- string getIban()
- {
- return IBAN;
- }
- double getBalance()
- {
- return balance;
- }
- private:
- double balance;
- std::string IBAN;
- };
- class Person
- {
- public:
- Person(string eName, string eLastName, string eOIB, BankAccount* eAccount)
- {
- name = eName;
- lastName = eLastName;
- oib = eOIB;
- account = eAccount;
- }
- ~Person() {}
- BankAccount* account;
- string getName()
- {
- return name;
- }
- string getLastName()
- {
- return lastName;
- }
- string getOib()
- {
- return oib;
- }
- private:
- string name;
- string lastName;
- string oib;
- };
- //
- //
- //class Bank
- //{
- //public:
- // Bank();
- // ~Bank();
- //
- // Person* getUser(string name)
- // {
- // for (auto it : users)
- // {
- // if (name == it.getName())
- // {
- // return ⁢
- // }
- // }
- // cout << "User doesnt exist!" << endl;
- // return nullptr;
- // }
- //
- // vector<Person> getUsers()
- // {
- // return users;
- // }
- //
- // void addUser()
- // {
- // string eName, eLastName, eOIB;
- // BankAccount* eAccount = createBankAccount();
- // cout << "Enter name: " << endl;
- // cin >> eName;
- //
- // cout << "Enter last name: " << endl;
- // cin >> eLastName;
- //
- // cout << "Enter oib: " << endl;
- // cin >> eOIB;
- //
- // if (checkForOib(eOIB))
- // {
- // //users.push_back(Person(eName, eLastName, eOIB, *eAccount));
- // }
- // else
- // {
- // cout << "User not created, missing " << "" << endl;
- // }
- //
- // }
- //
- // bool checkForOib(string eOib)
- // {
- // for (auto it : users)
- // {
- // if (eOib == it.getOib())
- // {
- // return false;
- // }
- // }
- // return true;
- // }
- // void withdrawFromAccount(string name, double ammount)
- // {
- // for (auto it : users)
- // {
- // if (name == it.getName())
- // {
- // (it.account)->withdraw(ammount);
- // }
- // }
- // }
- //
- // void depositToAccount(string name, double ammount)
- // {
- // for (auto it : users)
- // {
- // if (name == it.getName())
- // {
- // (it.account)->deposit(ammount);
- // }
- // }
- // }
- //
- //private:
- // vector<Person> users;
- // BankAccount* createBankAccount()
- // {
- // return new BankAccount("HR041234567891011");
- //
- //
- //};
- //
- int main()
- {
- //Bank pbz;
- BankAccount* temp = new BankAccount("");
- Person* osoba = new Person("sd", "ds", "ds", temp);
- osoba->account->deposit(10);
- cout << osoba->account->getBalance() << endl;
- /*
- while (true)
- {
- string choice;
- cout << " 1 - novi korisnik " << endl;
- cout << " 2 - deposit " << endl;
- cout << " 3 - withdraw" << endl;
- cout << " 4 - izlaz" << endl;
- cin >> choice;
- if (choice == "1")
- {
- pbz.addUser();
- }
- else if (choice == "2")
- {
- pbz.depositToAccount("", 30);
- }
- else if (choice == "3")
- {
- pbz.depositToAccount("", 30);
- }
- else if (choice == "4")
- {
- break;
- }
- }*/
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement