SHARE
TWEET

Untitled

a guest Jan 24th, 2020 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Bankomat.h"
  2.  
  3. Bankomat::Bankomat(std::string PIN,int AccountNumberPLN,int AccountNumberEUR,  float Euro,  float PLN )
  4. {
  5.     this->PIN =PIN;
  6.     this->AccountNumberPLN = AccountNumberPLN;
  7.     this->AccountNumberEURO =AccountNumberEUR;
  8.     this->Euro = Euro;
  9.     this->PLN = PLN;
  10.     this->CorrectPIN = false;
  11.     this->ExchangeRate = 4;
  12. }
  13.  
  14. Bankomat::~Bankomat()
  15. {
  16.     //dtor
  17. }
  18.  
  19.  
  20. bool Bankomat::CheckPIN(std::string PIN){
  21.     if(this->PIN == PIN)
  22.     {
  23.         this->CorrectPIN = true;
  24.         std::cout << "\nPoprawny PIN";
  25.         return true;
  26.     }
  27.     this->CorrectPIN = false;
  28.     std::cout << "\nBledny Pin";
  29.     return false;
  30.  
  31. }
  32.  
  33. void Bankomat::ChangePIN(std::string PIN){
  34.  
  35.     if(CorrectPIN){
  36.         this->PIN = PIN;
  37.         std::cout << "\nPin zmieniono";
  38.         return;
  39.     }
  40.     std::cout << "\nNajpierw zaloguj sie, pozniej zmie PIN";
  41. }
  42.  
  43. void Bankomat::PayPLN(float PLN){
  44.     if(!CorrectPIN){
  45.          std::cout << "\nNajpierw zaloguj sie";
  46.          return;
  47.     }
  48.     this->PLN += PLN;
  49.      std::cout << "\nWpłacono " << PLN <<" PLN";
  50. }
  51.  
  52. void Bankomat::PayEuro(float Euro){
  53.     if(!CorrectPIN){
  54.          std::cout << "\nNajpierw zaloguj sie";
  55.          return;
  56.     }
  57.     this->Euro +=Euro;
  58.         std::cout << "\nWpłacono " << Euro <<" EURO";
  59. }
  60.  
  61.  
  62. void  Bankomat::WithdrawPLN(float PLN){
  63.      if(!CorrectPIN){
  64.          std::cout << "\nNajpierw zaloguj sie";
  65.          return;
  66.     }
  67.     if(this->PLN < PLN )
  68.     {
  69.         std::cout << "\nZa mało środków na koncie";
  70.         return;
  71.     }
  72.     this->PLN -= PLN;
  73.      std::cout << "\nWypłacono " << PLN <<" PLN";
  74. }
  75. void  Bankomat::WithdrawEURO(float Euro){
  76.      if(!CorrectPIN){
  77.          std::cout << "\nNajpierw zaloguj sie";
  78.          return;
  79.     }
  80.     if(this->Euro < Euro )
  81.     {
  82.         std::cout << "\nZa mało środków na koncie";
  83.         return;
  84.     }
  85.     this->Euro -= Euro;
  86.      std::cout << "\nWypłacono " << PLN <<" PLN";
  87. }
  88.  
  89. float Bankomat::GetEuroQuantity(){
  90.     if(!CorrectPIN){
  91.         std::cout << "\nNajpierw zaloguj sie";
  92.         return 0;
  93.     }
  94.     return this->Euro;
  95. }
  96.  
  97. float Bankomat::GetPLNQuantity(){
  98.     if(!CorrectPIN){
  99.         std::cout << "\nNajpierw zaloguj sie";
  100.          return 0;
  101.     }
  102.     return this->PLN;
  103. }
  104.  
  105. void  Bankomat::ChangePLNToEuro(float PLN){
  106.     if(!CorrectPIN){
  107.          std::cout << "\nNajpierw zaloguj sie";
  108.          return;
  109.     }
  110.     if(this->PLN < PLN){
  111.         std::cout << "\nZa mało środków na koncie";
  112.         return;
  113.     }
  114.         this->Euro += (PLN / 4);
  115.         this->PLN -= PLN;
  116.         std::cout << "\nKupiono " << PLN/4 << " Euro za " << PLN << " PLN";
  117. }
  118.  
  119. void Bankomat::PrintPLN()
  120. {
  121.     std::cout << "\nNumer Rachunku PLN:  " << this->AccountNumberPLN << " Kwota: " << this->PLN < " PLN" ;
  122. }
  123.  
  124. void Bankomat::PrintEURO()
  125. {
  126.     std::cout << "\nNumer Rachunku EURO: " << this->AccountNumberEURO << " Kwota: " <<  this->Euro < " EURO" ;
  127. }
  128. void Bankomat::Print(){
  129.     PrintPLN();
  130.     PrintEURO();
  131. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top