Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. class TRachunek
  5. {
  6. string imie, nazwisko;
  7. double saldo;
  8. double debet;
  9. public:
  10. TRachunek(string i, string n, double s=0, double d=0)
  11. {
  12. imie=i;
  13. nazwisko=n;
  14. saldo=s;
  15. debet=d;
  16. }
  17. double PodajStanKonta()
  18. {
  19. return saldo;
  20. }
  21. void Wplata(double n)
  22. {
  23. saldo+=n;
  24. }
  25. bool Wyplata(double n)
  26. {
  27. if((saldo-n)>=debet)
  28. return true;
  29. else return false;
  30. }
  31. bool CzyDebet ()
  32. {
  33. if (saldo<0)
  34. return true;
  35. else return false;
  36. }
  37. bool Przelew(TRachunek *&rachunek, double kwota)
  38. {
  39.  
  40.  
  41. this->saldo-=kwota;
  42. if(this->saldo>=0)
  43. {
  44. rachunek->Wplata(kwota);
  45. return true;
  46. }
  47. else return false;
  48. }
  49.  
  50. double NaliczOdstetki(double oprocentowanie)
  51. {
  52.  
  53. oprocentowanie+=saldo*0.01*oprocentowanie;
  54. return oprocentowanie;
  55. }
  56. void Wyswietl()
  57. {
  58. cout<<"twoje saldo wyniosi: "<<saldo<<endl<<"twoj debet wynosi: "<<debet<<endl;
  59. }
  60. ~TRachunek()
  61. {
  62. ;
  63. };
  64. };
  65. int main()
  66. {
  67. cout<<"Alicja Nowak:"<<endl;
  68. TRachunek ror("Alicja","Nowak");
  69. ror.Wplata(400);
  70. cout<<"Oprocentowanie wynosi: "<<ror.NaliczOdstetki( 2.3)<<endl;
  71. ror.Wyswietl();
  72. TRachunek * pror;
  73. pror= new TRachunek("Jan","Kowalski", 1000, 500);
  74. ror.Przelew(pror, 350);
  75. cout<<"Jan Kowalski:"<<endl;
  76. pror->Wyswietl();
  77. return 0;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement