From 40ef2c1de4b211561b88f897999e6ace4062bf31 Mon Sep 17 00:00:00 2001 From: Arotex Date: Sat, 11 Oct 2025 18:45:39 +0200 Subject: [PATCH] =?UTF-8?q?Fahrzeugklasse=20begonnen,=20theorie=20verstand?= =?UTF-8?q?en=20n=C3=A4chstes=20thema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) 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 ("<