Working on #1

This commit is contained in:
Holger Boerchers 2018-12-23 13:39:09 +01:00
parent 0c15d4fbf3
commit ae5b12e235

View File

@ -12,12 +12,28 @@ private:
string postal_code_; string postal_code_;
string city_; string city_;
public: public:
address(const string&& street, const string&& street_no, const string&& postal_code, const string&& city) : street_(street), address() = default;
street_no_(street_no),
postal_code_(postal_code), address(const string&& street, const string&& street_no, const string&& postal_code, const string&& city) :
city_(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 class reservation final
@ -41,14 +57,39 @@ private:
string phone_no_; string phone_no_;
bool has_driving_license_ = false; bool has_driving_license_ = false;
public: public:
customer(string&& name, string&& first_name,address&& address, unsigned short&& year_of_birth, string&& phone_no, bool&& has_driving_license) : name_(name), customer()
first_name_(first_name),
address_(address),
year_of_birth_(year_of_birth),
phone_no_(phone_no),
has_driving_license_(has_driving_license)
{ {
}
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 rent_a_motorcycle();
void export_reservations(); void export_reservations();
list<customer> customers;
list<reservation> reservations; list<reservation> reservations;
int main() int main()
@ -82,7 +124,7 @@ int main()
system("cls"); system("cls");
cout << "Motorradvermietung (" << reservations.size() << " Reservierungen)" << endl << endl; cout << "Motorradvermietung (" << reservations.size() << " Reservierungen)" << endl << endl;
cout << "Bitte w\x84hlen Sie eine Option:" << 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 << "2: Erstellen einer Reservierung" << endl;
cout << "3: Motorrad herausgeben" << endl; cout << "3: Motorrad herausgeben" << endl;
cout << "4: Reservierungen exportieren" << 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()
{
}