From ae5b12e235f195baaacd11ad3a494a01454dc354 Mon Sep 17 00:00:00 2001 From: Holger Boerchers Date: Sun, 23 Dec 2018 13:39:09 +0100 Subject: [PATCH] Working on #1 --- src/Motorradvermietung.cpp | 89 +++++++++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 12 deletions(-) diff --git a/src/Motorradvermietung.cpp b/src/Motorradvermietung.cpp index ecf2160..4e07253 100644 --- a/src/Motorradvermietung.cpp +++ b/src/Motorradvermietung.cpp @@ -12,12 +12,28 @@ private: string postal_code_; string city_; public: - address(const string&& street, const string&& street_no, const string&& postal_code, const string&& city) : street_(street), - street_no_(street_no), - postal_code_(postal_code), - city_(city) + address() = default; + + address(const string&& street, const string&& street_no, const string&& postal_code, const string&& city) : + street_(street), + street_no_(street_no), + postal_code_(postal_code), + city_(city) { } + + friend istream& operator>>(istream& istr, address& address) + { + cout << "Strasse: "; + istr >> address.street_; + cout << "Hausnummer: "; + istr >> address.street_no_; + cout << "Postleitzahl: "; + istr >> address.postal_code_; + cout << "Ort: "; + istr >> address.city_; + return istr; + } }; class reservation final @@ -41,14 +57,39 @@ private: string phone_no_; bool has_driving_license_ = false; public: - customer(string&& name, string&& first_name,address&& address, unsigned short&& year_of_birth, string&& phone_no, bool&& has_driving_license) : name_(name), - first_name_(first_name), - address_(address), - year_of_birth_(year_of_birth), - phone_no_(phone_no), - has_driving_license_(has_driving_license) + customer() { - + } + + customer(string&& name, string&& first_name, address&& address, unsigned short&& year_of_birth, string&& phone_no, + bool&& has_driving_license) : name_(name), + first_name_(first_name), + address_(address), + year_of_birth_(year_of_birth), + phone_no_(phone_no), + has_driving_license_(has_driving_license) + { + } + + friend istream& operator>>(istream& istr, customer& customer) + { + cout << "Name: "; + istr >> customer.name_; + cout << "Vorname: "; + istr >> customer.first_name_; + cout << "Geburtsjahr: "; + istr >> customer.year_of_birth_; + istr >> customer.address_; + cout << "Telefonnumer: "; + istr >> customer.phone_no_; + cout << "Fuehrerschein der Klasse A? (J/N): "; + char driving_license; + istr >> driving_license; + if (driving_license == 'j' || driving_license == 'J') + { + customer.has_driving_license_ = true; + } + return istr; } }; @@ -73,6 +114,7 @@ void create_reservation(); void rent_a_motorcycle(); void export_reservations(); +list customers; list reservations; int main() @@ -82,7 +124,7 @@ int main() system("cls"); cout << "Motorradvermietung (" << reservations.size() << " Reservierungen)" << endl << endl; cout << "Bitte w\x84hlen Sie eine Option:" << endl; - cout << "1: Erstellen eines Kunden" << endl; + cout << "1: Neuen Kunden anlegen" << endl; cout << "2: Erstellen einer Reservierung" << endl; cout << "3: Motorrad herausgeben" << endl; cout << "4: Reservierungen exportieren" << endl; @@ -112,3 +154,26 @@ int main() } } } + +void create_customer() +{ + system("cls"); + cout << "Neuen Kunden anlegen" << endl; + cout << "------------------------------------" << endl; + + customer customer; + cin >> customer; + customers.push_back(customer); +} + +void create_reservation() +{ +} + +void rent_a_motorcycle() +{ +} + +void export_reservations() +{ +}