Account.cpp
Account.h
ATM.cpp
ATM.h
Bank.cpp
Bank.h
#include "Account.h" int Account::static_account_num = 0; Account::Account(Bank *bank_ptr, int user_password, string user_name) { this->bank = bank_ptr; this->password = user_password; this->name = user_name; for (int i = 0; i < 9; i++) { if (bank_list[i]==bank_ptr->getBankName()) { this->account_num = static_account_num + 111000000000 * (i+1); } } void Account::Withdrawal(ATM *ATM_obj) { } void Account::PrintAccountAll() {}
#include "ATM.h" #include "Bank.h" #include <iostream> #include <string> using namespace std; class Account { private: string bank_list[9] = {"하나", "신한", "국민", "우리", "농협", "대구", "카카오", "수협", "기업"}; static int static_account_num; int account_num; // 계좌번호 int password; // 비밀번호 int balance; // 잔액 Bank* bank; // 계좌 은행 포인터 string name; // 계좌 주 이름 public: Account(Bank *bank_ptr, int user_password, string user_name); Account *Account_list[5]; // Account_obj 담을 수 있는 list -> 5개로 제한, // 제한 안하면 이게 가능함??! void Withdrawal(ATM *ATM_obj); void PrintAccountAll(); void getBalance(); // 계좌 잔고 반환 int getPassword(); // 비밀번호 반환 void IsAdmin(); // admin인지 확인 void GetTransacHis(); // transaction history 확인 };
#include "ATM.h" #include <iostream> #include <string> using namespace std; int ATM::static_serial_num = 0; ATM::ATM(const string type, const string primary_bank, const string lang) { int serial_type; int serial_primary_bank; int serial_lang_type; int primary_bank_type; serial_number = static_serial_num; // bank type setting if (type == "single") { serial_type = 1; } else if (type == "multi") { serial_type = 2; } else { cout << "[Error] ~~~" << endl; } serial_number += 100000 * serial_type; // bank name setting for (int i = 0; i < 9; i++) { if (bank_list[i] == primary_bank) { serial_primary_bank = i + 1; } } serial_number += 10000 * serial_primary_bank; // language type setting if (lang == "unilingual") { serial_lang_type = 1; } else if (lang == "bilingual") { serial_lang_type = 2; } else { cout << "[ERROR] ~~~" << endl; } serial_number += 1000 * serial_lang_type; }
// atm header file #pragma once #include "Account.h" #include "Bank.h" #include <iostream> class Account; class Bank; using namespace std; class ATM { private: string bank_list[9] = { "하나", "신한", "국민", "우리", "농협", "대구", "카카오", "수협", "기업" }; int serial_number; // static int static_serial_num; public: ATM(const string, const string, const string); // multi bank ATM constructor ATM *ATM_list[5]; // ATM obj 담을 수 있는 list -> 5개로 제한, 제한 안하면 이게 // 가능함??! int available_cash; // ATM에 남은 돈 void Withdrawal_process(Account *Account_obj); void Withdrawal_fee(Account *Account_obj); void PrintATMAll(); };
#include "Bank.h" #include <iostream> #include <string> Bank::Bank(){ } void Bank::setDeposit(Account *account, int money){ } bool verifyPassword(Account *account, int pw){ }
//#pragma once #include "Account.h" #include <iostream> #include <string> using namespace std; class Account; class Bank { public: string bank_list[9] = {"하나", "신한", "국민", "우리", "농협", "대구", "카카오", "수협", "기업"}; string GetBankName(); void setDeposit(Account *, int); // deposit 결과 계좌에 반영 bool verifyPassword(Account *account, int pw); // pw가 account 비번 맞는지 확인 };