Compare commits
No commits in common. "main" and "A5" have entirely different histories.
@ -1,15 +0,0 @@
|
||||
# Klassen:
|
||||
- Verkehrsmittel
|
||||
- Posistion (int x, int y)
|
||||
- bewegen(neue Posistion)
|
||||
- text()
|
||||
- Luftfahrzeuge
|
||||
- max. Flughöhe
|
||||
- text()
|
||||
- Radfahrzeuge
|
||||
- Anzahl Räder
|
||||
- text()
|
||||
- Pkw
|
||||
- Anzahl Türen
|
||||
- text()
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
#pragma once
|
||||
#include "Verkehrsmittel.h"
|
||||
class Luftfahrzeug : public Verkehrsmittel{
|
||||
private:
|
||||
int maxFlughöhe;
|
||||
public:
|
||||
Luftfahrzeug (int maxFlughöhe){
|
||||
this->maxFlughöhe = maxFlughöhe;
|
||||
};
|
||||
std::string text();
|
||||
};
|
||||
@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
#include "Radfahrzeug.h"
|
||||
#include "Verkehrsmittel.h"
|
||||
|
||||
class PKW : public Radfahrzeug {
|
||||
private:
|
||||
int anzahlTüren;
|
||||
|
||||
public:
|
||||
PKW(int raeder, int türen) : Radfahrzeug(raeder) { anzahlTüren = türen; }
|
||||
std::string text();
|
||||
};
|
||||
@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
#include "Verkehrsmittel.h"
|
||||
|
||||
class Radfahrzeug : public Verkehrsmittel {
|
||||
private:
|
||||
int anzahlRäder;
|
||||
|
||||
public:
|
||||
Radfahrzeug(int räder) { this->anzahlRäder = räder; }
|
||||
std::string text();
|
||||
int getRäder();
|
||||
};
|
||||
@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class Verkehrsmittel{
|
||||
private:
|
||||
int posX = 0;
|
||||
int posY = 0;
|
||||
int position[2] = {posX,posY};
|
||||
public:
|
||||
void bewege(int x, int y);
|
||||
virtual std::string text();
|
||||
int getX();
|
||||
int getY();
|
||||
};
|
||||
@ -1,10 +1,9 @@
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include "Verkehrsmittel.h"
|
||||
#include "Luftfahrzeug.h"
|
||||
#include "Radfahrzeug.h"
|
||||
#include "PKW.h"
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
//Verkehrsmittel
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
#include "Luftfahrzeug.h"
|
||||
#include "PKW.h"
|
||||
#include "Radfahrzeug.h"
|
||||
#include "Verkehrsmittel.h"
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
// Verkehrsmittel - Position x: 0; Position y: 0
|
||||
int Verkehrsmittel::getX() { return posX; }
|
||||
int Verkehrsmittel::getY() { return posY; }
|
||||
int Radfahrzeug::getRäder() { return anzahlRäder; }
|
||||
|
||||
void Verkehrsmittel::bewege(int x, int y) {
|
||||
this->posX = x;
|
||||
this->posY = y;
|
||||
}
|
||||
|
||||
std::string Verkehrsmittel::text() {
|
||||
std::string Xstring = std::to_string(getX());
|
||||
std::string Ystring = std::to_string(getY());
|
||||
std::string Fahrzeug = "Verkehrsmittel";
|
||||
std::stringstream output;
|
||||
output << Fahrzeug << " - " << "Position x: " << Xstring
|
||||
<< "; Position y: " << Ystring;
|
||||
return output.str();
|
||||
}
|
||||
|
||||
std::string Luftfahrzeug::text() {
|
||||
std::string Xstring = std::to_string(getX());
|
||||
std::string Ystring = std::to_string(getY());
|
||||
std::string FlughöheString = std::to_string(maxFlughöhe);
|
||||
std::string Fahrzeug = "Luftfahrzeug";
|
||||
std::stringstream output;
|
||||
output << Fahrzeug << " - " << "Position x: " << Xstring
|
||||
<< "; Position y: " << Ystring << "; max. Höhe: " << FlughöheString;
|
||||
return output.str();
|
||||
}
|
||||
|
||||
std::string Radfahrzeug::text() {
|
||||
std::string Xstring = std::to_string(getX());
|
||||
std::string Ystring = std::to_string(getY());
|
||||
std::string RäderString = std::to_string(anzahlRäder);
|
||||
std::string Fahrzeug = "Radfahrzeug";
|
||||
std::stringstream output;
|
||||
output << Fahrzeug << " - " << "Position x: " << Xstring
|
||||
<< "; Position y: " << Ystring << "; Anzahl Räder: " << RäderString;
|
||||
return output.str();
|
||||
}
|
||||
|
||||
std::string PKW::text() {
|
||||
std::string Xstring = std::to_string(getX());
|
||||
std::string Ystring = std::to_string(getY());
|
||||
std::string Räderstring = std::to_string(getRäder());
|
||||
std::string TürenString = std::to_string(anzahlTüren);
|
||||
std::string Fahrzeug = "PKW";
|
||||
std::stringstream output;
|
||||
output << Fahrzeug << " - " << "Position x: " << Xstring
|
||||
<< "; Position y: " << Ystring << "; Anzahl Räder: " << Räderstring
|
||||
<< "; Anzahl Türen: " << TürenString;
|
||||
return output.str();
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user