Advertisement
Guest User

a

a guest
Jan 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.76 KB | None | 0 0
  1. /**
  2.  * @(#) Account.h
  3.  */
  4.  
  5. #ifndef ACCOUNT_H_H
  6. #define ACCOUNT_H_H
  7.  
  8. #include "Coin.h"
  9. #include "send_recieve.h"
  10. #include "PropertyHistory.h"
  11. #include "Wallet.h"
  12.  
  13. class Account
  14. {
  15.     private:
  16.         int accountId;
  17.         float cash;
  18.         PropertyHistory property_history;
  19.         Wallet wallet;
  20.  
  21.     public:
  22.         Account( int id );
  23.         Account( int id, float cash );
  24.         ~Account( );
  25.  
  26.         // Buy & Sell
  27.         void sellCoin( Coin coin, int amount );
  28.         void buyCoin( Coin coin, int amount );
  29.  
  30.         // Cahs
  31.         bool addBalance( float amout );
  32.         bool changeBalance( float amount );
  33.         float chashStatus();
  34.  
  35.         int getID();
  36. };
  37.  
  38. #endif
  39.  
  40.  
  41. /**
  42.  * @(#) Account.cpp
  43.  */
  44.  
  45.  
  46. #include "Account.h"
  47.  
  48. Account::Account( int id )
  49. {
  50.     this->accountId = id;
  51.     this->cash = 0;
  52.     this->wallet = Wallet();
  53.     this->property_history = PropertyHistory();
  54. }
  55.  
  56. Account::Account( int id, float cash )
  57. {
  58.     this->accountId = id;
  59.     this->cash = cash;
  60.     this->wallet = Wallet();
  61.     this->property_history = PropertyHistory();
  62. }
  63.  
  64.  
  65. Account::~Account( )
  66. {
  67.  
  68. }
  69.  
  70. /**
  71.  *
  72.  * @param coin
  73.  * @param amount
  74.  */
  75. void Account::buyCoin( Coin coin, int amount )
  76. {
  77.     this->wallet.recieveCoin( coin.getName(), amount );
  78.     //this->property_history.addTransaction();
  79. }
  80.  
  81. /**
  82.  *
  83.  * @param coin
  84.  * @param amount
  85.  */
  86. void Account::sellCoin( Coin coin, int amount )
  87. {
  88.     this->wallet.sendCoin( coin.getName(), amount );
  89. }
  90.  
  91. /**
  92.  *
  93.  * @param amount
  94.  * @return
  95.  */
  96. bool Account::changeBalance( float amount )
  97. {
  98.     this->cash = amount;
  99. }
  100.  
  101. /**
  102.  *
  103.  * @param amout
  104.  * @return
  105.  */
  106. bool Account::addBalance( float amout )
  107. {
  108.     this->cash += amout;
  109. }
  110.  
  111. /**
  112.  *
  113.  * @return
  114.  */
  115. int Account::getID()
  116. {
  117.     return this->accountId;
  118. }
  119.  
  120. /**
  121.  *
  122.  * @return
  123.  */
  124. float Account::chashStatus( )
  125. {
  126.     return this->cash;
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement