diff --git a/main.cpp b/main.cpp index 566dc6a..d96c79b 100644 --- a/main.cpp +++ b/main.cpp @@ -6,6 +6,60 @@ int number = 12; char Buchstabe = 'a'; +class Fahrzeug +{ +private: + int kw; + float ps; + float verbrauch; +public: + std::string Hersteller; + Fahrzeug(std::string s_Hersteller, int i_kw); + ~Fahrzeug(); + + void mechanical_view(); + float fn_enginechange(int new_kw); + +}; + +Fahrzeug::Fahrzeug(std::string s_Hersteller, int i_kw) +{ + kw = i_kw; + ps = i_kw * 1.36; + Hersteller = s_Hersteller; + verbrauch = 6.3; +} + +Fahrzeug::~Fahrzeug() +{ +} + +float Fahrzeug::fn_enginechange(int new_kw){ + float cost = 0; + cost = 100+new_kw*10; + this->verbrauch = new_kw/(100*.3); + this->kw = new_kw; + this->ps = new_kw*1.36; + + return cost; +} + +void Fahrzeug::mechanical_view(){ + std::cout <<"Das Gerät ist von "<< Hersteller << " und hat eine Leistung von "<< kw <<"kw ("<