jelenpivo123

Automobil.cpp

Oct 5th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. #include "Automobil.h"
  5.  
  6. using namespace std;
  7.  
  8. void Automobil::upisiInformacije(string putanja){
  9.  
  10. ofstream citanjeFajla;
  11. citanjeFajla.open(putanja,ios_base::app);
  12. citanjeFajla<<this->getMarka()<<" " <<this->getModel()<<this->getGodinaProizvodnje()<<" " <<this->getBrojRegistracije()<<" " <<this->getDatumRegistracije() <<" "<<this->getSnagaMotora()<<" "<<this->getBrojVrata()<<" "<<this->getBoja()<<" "<<this->getBrojSasije()<<endl;
  13. citanjeFajla.close();
  14.  
  15.  
  16. }
  17.  
  18. void Automobil::ispisiIzvestaj(string putanja){
  19.  
  20. ifstream ispisivanjeFajla;
  21. ispisivanjeFajla.open(putanja);
  22.  
  23. if(ispisivanjeFajla.is_open()){
  24.  
  25. string red;
  26. while(getline(ispisivanjeFajla,red)){
  27. cout<< red <<endl;
  28. }
  29.  
  30. }
  31. ispisivanjeFajla.close();
  32.  
  33. }
  34.  
  35. void Automobil::print(){
  36.  
  37. cout<<this->getMarka()<<" " <<this->getModel()<<this->getGodinaProizvodnje()<<" " <<this->getBrojRegistracije()<<" " <<this->getDatumRegistracije() <<" "<<this->getSnagaMotora()<<" "<<this->getBrojVrata()<< " "<<this->getBoja()<<" "<<this->getBrojSasije()<<endl;
  38. }
  39.  
  40.  
  41. void Automobil:: setSnagaMotora(int snagaMotora){
  42.  
  43. this->snagaMotora = snagaMotora;
  44. }
  45.  
  46. void Automobil::setBrojVrata(int brojVrata){
  47.  
  48.  
  49. this->brojVrata = brojVrata;
  50. }
  51. void Automobil::setBrojSasisje(int brojSasisje){
  52.  
  53. this->brojSasije = brojSasisje;
  54. }
  55.  
  56. void Automobil::setBoja(string boja){
  57.  
  58. this->boja = boja;
  59. }
  60. int Automobil::getSnagaMotora(){
  61.  
  62. return this->snagaMotora;
  63. }
  64. int Automobil::getBrojVrata(){
  65.  
  66. return this->brojVrata;
  67. }
  68. int Automobil::getBrojSasije(){
  69. return this->brojSasije;
  70. }
  71. string Automobil::getBoja(){
  72. return this->boja;
  73.  
  74.  
  75. }
  76. Automobil::Automobil(){
  77.  
  78.  
  79. }
  80.  
  81. Automobil::Automobil(string marka, string model, int godinaProizvodnje, string brojRegistracije, string datumRegistracije, int snagaMotora, int brojVrata, int brojSasije, string boja) : Vozilo(marka,model,godinaProizvodnje), Registracija(brojRegistracije, datumRegistracije){
  82.  
  83. this->snagaMotora = snagaMotora;
  84. this->brojVrata = brojVrata;
  85. this->brojSasije = brojSasije;
  86. this->boja = boja;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment