working on..
This commit is contained in:
parent
0bcc421678
commit
0094764a34
@ -156,26 +156,24 @@ private:
|
|||||||
customer* customer_;
|
customer* customer_;
|
||||||
public:
|
public:
|
||||||
reservation(string start, string end, const short motorcycle, customer* customer) : id_(++next_reservation_id),
|
reservation(string start, string end, const short motorcycle, customer* customer) : id_(++next_reservation_id),
|
||||||
start_(
|
start_(move(start)),
|
||||||
std::move(start)), end_(
|
end_(move(end)),
|
||||||
std::move(end)),
|
|
||||||
motorcycle_(motorcycle),
|
motorcycle_(motorcycle),
|
||||||
customer_(customer)
|
customer_(customer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
string motorcycles[] = {
|
string motorcycles[] =
|
||||||
|
{
|
||||||
"Suzuki Bandit",
|
"Suzuki Bandit",
|
||||||
"Honda TransAlp",
|
"Honda TransAlp",
|
||||||
"BMW F 650 GS"
|
"BMW F 650 GS",
|
||||||
"Kawasaki ZZR1400"
|
"Kawasaki ZZR1400"
|
||||||
};
|
};
|
||||||
|
|
||||||
list<customer*> customers;
|
list<customer*> customers;
|
||||||
list<reservation*> reservations;
|
list<reservation*> reservations;
|
||||||
int size_of_motorcycles = 4;
|
|
||||||
|
|
||||||
void create_customer();
|
void create_customer();
|
||||||
void create_reservation();
|
void create_reservation();
|
||||||
void rent_a_motorcycle();
|
void rent_a_motorcycle();
|
||||||
@ -302,6 +300,26 @@ customer* find_customer_by_first_name(const vector<customer*>& filtered_customer
|
|||||||
return nullptr;
|
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()
|
void create_reservation()
|
||||||
{
|
{
|
||||||
system("cls");
|
system("cls");
|
||||||
@ -332,7 +350,9 @@ void create_reservation()
|
|||||||
|
|
||||||
const auto start_date = get_validated_date("Startdatum");
|
const auto start_date = get_validated_date("Startdatum");
|
||||||
const auto end_date = get_validated_date("Enddatum");
|
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()
|
void rent_a_motorcycle()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user