Aufgabe 3 fertig
This commit is contained in:
parent
1b3ae9e39b
commit
0644adfb29
9 changed files with 223 additions and 28 deletions
152
Aufgabenblock_1/.settings/org.eclipse.cdt.core.prefs
Normal file
152
Aufgabenblock_1/.settings/org.eclipse.cdt.core.prefs
Normal file
|
@ -0,0 +1,152 @@
|
|||
#Tue Oct 18 10:56:30 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
|
||||
org.eclipse.cdt.core.formatter.alignment_for_compact_if=0
|
||||
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=80
|
||||
org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
|
||||
org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
|
||||
org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=end_of_line
|
||||
org.eclipse.cdt.core.formatter.compact_else_if=true
|
||||
org.eclipse.cdt.core.formatter.continuation_indentation=2
|
||||
org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||
org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||
org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
|
||||
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
|
||||
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
|
||||
org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||
org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false
|
||||
org.eclipse.cdt.core.formatter.indent_empty_lines=false
|
||||
org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
|
||||
org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
|
||||
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||
org.eclipse.cdt.core.formatter.indentation.size=4
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
|
||||
org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||
org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
|
||||
org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
|
||||
org.eclipse.cdt.core.formatter.lineSplit=80
|
||||
org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||
org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
|
||||
org.eclipse.cdt.core.formatter.tabulation.char=tab
|
||||
org.eclipse.cdt.core.formatter.tabulation.size=4
|
||||
org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
4
Aufgabenblock_1/.settings/org.eclipse.cdt.ui.prefs
Normal file
4
Aufgabenblock_1/.settings/org.eclipse.cdt.ui.prefs
Normal file
|
@ -0,0 +1,4 @@
|
|||
#Tue Oct 18 10:56:30 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
formatter_profile=org.eclipse.cdt.ui.default.kandr_profile
|
||||
formatter_settings_version=1
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
#include "Fahrrad.h"
|
||||
|
||||
/* Standardkonstruktor */
|
||||
Fahrrad::Fahrrad() : Fahrzeug() { }
|
||||
|
||||
Fahrrad::Fahrrad(string sName, double dMaxGeschwindigkeit) :
|
||||
Fahrzeug(sName, dMaxGeschwindigkeit) { }
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ using namespace std;
|
|||
|
||||
class Fahrrad: public Fahrzeug {
|
||||
public:
|
||||
Fahrrad();
|
||||
Fahrrad(string sName, double dMaxGeschwindigkeit);
|
||||
virtual ~Fahrrad();
|
||||
|
||||
|
|
|
@ -8,18 +8,21 @@ extern double dGlobaleZeit;
|
|||
|
||||
int Fahrzeug::p_iMaxID = 0;
|
||||
|
||||
/* Standardkonstruktor */
|
||||
Fahrzeug::Fahrzeug() {
|
||||
vInitialisierung();
|
||||
//cout << this->p_sName << ":" << this->p_iID << " wurde initialisiert" << endl;
|
||||
}
|
||||
|
||||
/* Kopierkonstruktor */
|
||||
Fahrzeug::Fahrzeug(Fahrzeug &fz) {
|
||||
vInitialisierung();
|
||||
|
||||
p_sName = fz.p_sName;
|
||||
p_dMaxGeschwindigkeit = fz.p_dMaxGeschwindigkeit;
|
||||
|
||||
/* p_dGesamtStrecke, p_dGesamtZeit, p_dZeit werden auf 0 gesetzt */
|
||||
/* p_dGesamtStrecke, p_dGesamtZeit, p_dZeit werden auf 0 gesetzt,
|
||||
* da das kopierte noch keine Strecke zurückgelegt hat */
|
||||
}
|
||||
|
||||
Fahrzeug::Fahrzeug(string sName) {
|
||||
|
@ -43,7 +46,7 @@ Fahrzeug::~Fahrzeug() {
|
|||
void Fahrzeug::vInitialisierung() {
|
||||
p_iID = ++p_iMaxID;
|
||||
|
||||
p_sName = " ";
|
||||
p_sName = "";
|
||||
p_dMaxGeschwindigkeit = 0;
|
||||
p_dGesamtStrecke = 0;
|
||||
p_dGesamtZeit = 0;
|
||||
|
@ -79,7 +82,7 @@ ostream& Fahrzeug::ostreamAusgabe(ostream &stream) const {
|
|||
}
|
||||
|
||||
void Fahrzeug::vAbfertigung() {
|
||||
/* nicht doppelt abfertigen */
|
||||
/* nicht doppelt abfertigen (Gleitkommavgl.) */
|
||||
if (fabs(p_dZeit - dGlobaleZeit) < 1e-10) return;
|
||||
|
||||
double dDelta = dGlobaleZeit - p_dZeit;
|
||||
|
@ -89,10 +92,18 @@ void Fahrzeug::vAbfertigung() {
|
|||
p_dZeit = dGlobaleZeit;
|
||||
}
|
||||
|
||||
bool Fahrzeug::operator<(Fahrzeug fz) {
|
||||
return (p_dGesamtStrecke < fz.p_dGesamtStrecke);
|
||||
double Fahrzeug::dGeschwindigkeit() {
|
||||
return p_dMaxGeschwindigkeit;
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream &stream, const Fahrzeug fz) {
|
||||
double Fahrzeug::dTanken(double dMenge = 0.0) {
|
||||
return 0;
|
||||
};
|
||||
|
||||
bool Fahrzeug::operator<(Fahrzeug &fz) const {
|
||||
return (this->p_dGesamtStrecke < fz.p_dGesamtStrecke);
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream &stream, const Fahrzeug &fz) {
|
||||
return fz.ostreamAusgabe(stream);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ using namespace std;
|
|||
class Fahrzeug {
|
||||
public:
|
||||
Fahrzeug();
|
||||
Fahrzeug(Fahrzeug &fz);
|
||||
Fahrzeug(Fahrzeug &fz); /* Kopier Konstruktor */
|
||||
Fahrzeug(string sName);
|
||||
Fahrzeug(string sName, double dMaxGeschwindkeit);
|
||||
|
||||
|
@ -25,10 +25,11 @@ public:
|
|||
virtual ostream& ostreamAusgabe(ostream &stream) const;
|
||||
|
||||
virtual void vAbfertigung();
|
||||
virtual double dTanken(double dMenge = 0.0) { return 0; };
|
||||
virtual double dGeschwindigkeit() const { return p_dMaxGeschwindigkeit; }
|
||||
virtual double dTanken(double dMenge = 0.0);
|
||||
virtual double dGeschwindigkeit() const;
|
||||
|
||||
bool operator<(Fahrzeug fz);
|
||||
bool operator<(Fahrzeug &fz) const;
|
||||
//Fahrzeug & operator=(Fahrzeug &fz); /* benutze Standardzuweisungs Operator */
|
||||
|
||||
static void vAusgabeHeader();
|
||||
|
||||
|
@ -46,6 +47,6 @@ private:
|
|||
void vInitialisierung();
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream &out, const Fahrzeug fz);
|
||||
ostream& operator<<(ostream &out, const Fahrzeug &fz);
|
||||
|
||||
#endif /* FAHRZEUG_H_ */
|
||||
|
|
|
@ -7,24 +7,28 @@ using namespace std;
|
|||
|
||||
extern double dGlobaleZeit;
|
||||
|
||||
/* Standardkonstruktor */
|
||||
PKW::PKW() : Fahrzeug() { }
|
||||
|
||||
PKW::PKW(string sName, double dMaxGeschwindigkeit) :
|
||||
Fahrzeug(sName, dMaxGeschwindigkeit) { };
|
||||
Fahrzeug(sName, dMaxGeschwindigkeit) {
|
||||
}
|
||||
|
||||
PKW::PKW(string sName, double dMaxGeschwindigkeit, double dVerbrauch, double dTankvolumen) :
|
||||
Fahrzeug(sName, dMaxGeschwindigkeit),
|
||||
p_dVerbrauch(dVerbrauch),
|
||||
p_dTankinhalt(dTankvolumen/2),
|
||||
p_dTankvolumen(dTankvolumen) { };
|
||||
PKW::PKW(string sName, double dMaxGeschwindigkeit, double dVerbrauch,
|
||||
double dTankvolumen) :
|
||||
Fahrzeug(sName, dMaxGeschwindigkeit), p_dVerbrauch(dVerbrauch),
|
||||
p_dTankinhalt(dTankvolumen / 2), p_dTankvolumen(dTankvolumen) {
|
||||
}
|
||||
|
||||
PKW::~PKW() { }
|
||||
PKW::~PKW() {
|
||||
}
|
||||
|
||||
double PKW::dTanken(double dMenge) {
|
||||
double dAlterInhalt = p_dTankinhalt;
|
||||
|
||||
if (dMenge == 0) {
|
||||
p_dTankinhalt = p_dTankvolumen;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
p_dTankinhalt += dMenge;
|
||||
if (p_dTankinhalt > p_dTankvolumen) {
|
||||
p_dTankinhalt = p_dTankvolumen; /* Verhindere Überfüllung */
|
||||
|
@ -36,10 +40,11 @@ double PKW::dTanken(double dMenge) {
|
|||
|
||||
void PKW::vAbfertigung() {
|
||||
if (p_dTankinhalt > 0) { /* prüfen, ob etwas im Tank ist */
|
||||
p_dTankinhalt -= (dGlobaleZeit - p_dZeit) * p_dMaxGeschwindigkeit * p_dVerbrauch / 100;
|
||||
p_dTankinhalt -= (dGlobaleZeit - p_dZeit) * p_dMaxGeschwindigkeit
|
||||
* p_dVerbrauch / 100;
|
||||
|
||||
if (p_dTankinhalt < 0) { /* falls Tankinhalt negativ ist */
|
||||
p_dTankinhalt = 0;
|
||||
p_dTankinhalt = 0;
|
||||
}
|
||||
|
||||
Fahrzeug::vAbfertigung();
|
||||
|
@ -57,9 +62,9 @@ void PKW::vAusgabe() const {
|
|||
|
||||
ostream& PKW::ostreamAusgabe(ostream &stream) const {
|
||||
Fahrzeug::ostreamAusgabe(stream) << setprecision(2) << setiosflags(ios::fixed)
|
||||
<< resetiosflags(ios::left) << setiosflags(ios::right)
|
||||
<< setw(12) << dVerbrauch()
|
||||
<< setw(13) << p_dTankinhalt;
|
||||
<< resetiosflags(ios::left) << setiosflags(ios::right)
|
||||
<< setw(12) << dVerbrauch()
|
||||
<< setw(13) << p_dTankinhalt;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ using namespace std;
|
|||
|
||||
class PKW: public Fahrzeug {
|
||||
public:
|
||||
PKW();
|
||||
PKW(string sName, double dMaxGeschwindigkeit);
|
||||
PKW(string sName, double dMaxGeschwindigkeit, double dVerbrauch, double dTankvolumen = 55);
|
||||
virtual ~PKW();
|
||||
|
|
|
@ -128,11 +128,28 @@ void vAufgabe2() {
|
|||
void vAufgabe3() {
|
||||
PKW vw("Golf", 200, 6.7, 88);
|
||||
Fahrrad velo("Haibike", 22);
|
||||
Fahrzeug sch("Schiff", 22);
|
||||
Fahrzeug boat("Schiff", 11);
|
||||
|
||||
PKW::vAusgabeHeader();
|
||||
dGlobaleZeit += 1.0;
|
||||
velo.vAbfertigung();
|
||||
|
||||
cout << vw << endl << velo << endl << sch;
|
||||
Fahrzeug::vAusgabeHeader();
|
||||
cout << vw << endl << velo << endl << boat << endl << endl;
|
||||
|
||||
if (vw < velo) {
|
||||
cout << "Das Fahrrad ist bereits weiter gefahren" << endl;
|
||||
}
|
||||
else {
|
||||
cout << "Der Golf ist bereits weiter gefahren" << endl;
|
||||
}
|
||||
|
||||
Fahrrad veloKopie = velo; /* benutze Kopier Konstrukutor */
|
||||
Fahrrad veloKopie2;
|
||||
|
||||
veloKopie2 = velo; /* benutze Zuweisungsoperator */
|
||||
|
||||
Fahrzeug::vAusgabeHeader();
|
||||
cout << veloKopie << endl << veloKopie2 << endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
Loading…
Add table
Reference in a new issue