Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. class RachunekBankowy
  7. {
  8. private:
  9. enum RodzajKonta {ROR,LOKATA,JUNIOR,SENIOR,VIP,STUDENT};
  10. string imie;
  11. string nazwisko;
  12. string adres;
  13. string iban;
  14. float saldo;
  15. float oprocentowanieRachunku;
  16. float debet;
  17. float oprocentowanieDebetu;
  18. RodzajKonta rodzaj = ROR;
  19. public:
  20. RachunekBankowy ( string imieInfo, string NazwiskoInfo, string AdresInfo, string ibanInfo, float saldoInfo, float RachunekInfo, float debetInfo, float DebetuInfo)
  21. {
  22. this->imie = imieInfo;
  23. this->nazwisko = NazwiskoInfo;
  24. this->adres = AdresInfo;
  25. this->iban = ibanInfo;
  26. this->saldo = saldoInfo;
  27. this->oprocentowanieRachunku = RachunekInfo;
  28. this->debet = debetInfo;
  29. this-> oprocentowanieDebetu = DebetuInfo;
  30. }
  31. string getImie () { return this ->imie;}
  32. string getNazwisko() {return this->nazwisko;}
  33. string getAdres() { return this->adres;}
  34. string getInban() { return this->iban;}
  35. float getSaldo() { return this->saldo;}
  36. float getOprocentowanieRachunku (){ return this->oprocentowanieRachunku;}
  37. float getDebet () { return this->debet;}
  38. float getOprocentowanieDebetu() { return this->oprocentowanieDebetu;}
  39. bool setImie( string name)
  40. {
  41. this->imie = name;
  42. return true;
  43. }
  44. bool setNazwisko ( string surname )
  45. {
  46. this->nazwisko = surname;
  47. return true;
  48. }
  49. bool setAdres ( string adress)
  50. {
  51. this->adres = adress;
  52. return true;
  53. }
  54. bool setIban ( string IBAN)
  55. {
  56. this->iban = IBAN;
  57. return true;
  58. }
  59. bool setSaldo (float SALDO)
  60. {
  61. this->saldo = SALDO;
  62. return true;
  63. }
  64. bool setOpRach ( float oproc)
  65. {
  66. this->oprocentowanieRachunku = oproc;
  67. return true;
  68. }
  69. bool setOpDeb ( float oprocDeb)
  70. {
  71. this->oprocentowanieDebetu = oprocDeb;
  72. return true;
  73. }
  74. bool setDebet ( float Debit)
  75. {
  76. if ( Debit >= 0 )
  77. {
  78. this->debet = Debit;
  79. return true;
  80. }
  81. else
  82. {
  83. Debit = (-1) * Debit;
  84. this->debet = Debit;
  85. return true;
  86. }
  87. }
  88. float wplata ( float numer)
  89. {
  90. if ( numer >= 0)
  91. this->saldo += numer;
  92. else
  93. cout << "Enter valid number!" << endl;
  94. return saldo;
  95. }
  96.  
  97. float wyplata ( float numer)
  98. {
  99. if ( numer >= 0)
  100. {
  101. if ( this->saldo - numer >= (this->debet * (-1)))
  102. {
  103. this->saldo -= numer;
  104. return this->saldo;
  105. }
  106. else
  107. {
  108. cout << "nie mozna wyplacic takiej kwoty, przekracza ona debet" << endl;
  109. return this->saldo;
  110. }
  111. }
  112. else
  113. cout << "enter valid number!" << endl;
  114. }
  115.  
  116. float odsetki ()
  117. {
  118. if ( saldo > 0 )
  119. {
  120. saldo += saldo * oprocentowanieRachunku;
  121.  
  122. }
  123. if ( saldo < 0)
  124. {
  125. saldo -= (saldo * (-1.0)) * oprocentowanieDebetu;
  126.  
  127. }
  128. return saldo;
  129. }
  130. string toString ()
  131. {
  132. string wynik = to_string(saldo);
  133. wynik = wynik + " zlotych";
  134. return wynik;
  135. }
  136.  
  137. };
  138.  
  139. class Zleceniobiorca
  140. {
  141. string nazwa;
  142. int regon;
  143. public:
  144. RachunekBankowy rachunekBankowy;
  145.  
  146. Zleceniobiorca ( string name, int r, RachunekBankowy rb )
  147. { // niewazne
  148. this->nazwa = name;
  149. this->regon = r;
  150. this->rachunekBankowy = rb;
  151. }
  152. string getNazwa()
  153. {
  154. return this->nazwa;
  155. }
  156. int getRegon()
  157. {
  158. return this->regon;
  159. }
  160. RachunekBankowy getRachunekBankowy()
  161. {
  162. return this->rachunekBankowy;
  163. }
  164. bool setNazwa ( string n)
  165. {
  166. this->nazwa = n;
  167. return true;
  168. }
  169. bool setRegon ( int r )
  170. {
  171. this->regon = r;
  172. return true;
  173. }
  174. bool setRachunek (RachunekBankowy rb)
  175. {
  176. this->rachunekBankowy = rb;
  177. return true;
  178. }
  179.  
  180. };
  181.  
  182.  
  183.  
  184. int main ()
  185. {
  186.  
  187. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement