working on..
This commit is contained in:
parent
0bcc421678
commit
0094764a34
@ -156,26 +156,24 @@ private:
|
||||
customer* customer_;
|
||||
public:
|
||||
reservation(string start, string end, const short motorcycle, customer* customer) : id_(++next_reservation_id),
|
||||
start_(
|
||||
std::move(start)), end_(
|
||||
std::move(end)),
|
||||
start_(move(start)),
|
||||
end_(move(end)),
|
||||
motorcycle_(motorcycle),
|
||||
customer_(customer)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
string motorcycles[] = {
|
||||
string motorcycles[] =
|
||||
{
|
||||
"Suzuki Bandit",
|
||||
"Honda TransAlp",
|
||||
"BMW F 650 GS"
|
||||
"BMW F 650 GS",
|
||||
"Kawasaki ZZR1400"
|
||||
};
|
||||
|
||||
list<customer*> customers;
|
||||
list<reservation*> reservations;
|
||||
int size_of_motorcycles = 4;
|
||||
|
||||
void create_customer();
|
||||
void create_reservation();
|
||||
void rent_a_motorcycle();
|
||||
@ -302,6 +300,26 @@ customer* find_customer_by_first_name(const vector<customer*>& filtered_customer
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int select_motorcycle()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
cout << "Bitte w\x84hlen sie ein Motorrad aus:" << endl;
|
||||
auto index = 0;
|
||||
for (const auto& cycle : motorcycles)
|
||||
{
|
||||
cout << ++index << ": " << cycle << endl;
|
||||
}
|
||||
const auto answer = ask_question<unsigned int>("Auswahl");
|
||||
const auto size = static_cast<int>(sizeof(motorcycles) / sizeof(*motorcycles));
|
||||
if (answer > 0 && answer <= size)
|
||||
{
|
||||
return answer - 1;
|
||||
}
|
||||
cout << "Ung\x81ltige Eingabe" << endl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void create_reservation()
|
||||
{
|
||||
system("cls");
|
||||
@ -332,7 +350,9 @@ void create_reservation()
|
||||
|
||||
const auto start_date = get_validated_date("Startdatum");
|
||||
const auto end_date = get_validated_date("Enddatum");
|
||||
auto r = reservation(start_date, end_date, 2, current);
|
||||
const auto motorcycle = select_motorcycle();
|
||||
const auto r = new reservation(start_date, end_date, motorcycle, current);
|
||||
reservations.push_back(r);
|
||||
}
|
||||
|
||||
void rent_a_motorcycle()
|
||||
|
Loading…
x
Reference in New Issue
Block a user