edit removed
edit removed
your method checkIn wants a Gast object, not a string object!
(void checkIn(Gast nieuweGast))
so, change hotel.checkIn("Guido"); to hotel.checkIn(new Gast("Guido"));
thanks a lot, it compiles now! However, it doesnt do what it is supposed to do.
Now when i start and input 2 it performs the checkIn(new Gast("guido")) and goes to
afterwards the menu comes up again, but when i press 2 again, it doesn't go to the second room (kamer). how can this be? the kamer1.gast has the value guido after the first time right? so it is not equal to null. So why then does it still take the first if statement?Code:if (kamer1.gast == null) {
kamer1.gast = nieuweGast;
System.out.println("Gast " + nieuweGast.naam + " krijgt kamer 1");
return;
}
anybody any ideas? thanks a lot!
because you create a new hotel:
Hotel hotel = new Hotel();
hotel.checkIn("Guido");
so every time you create a new hotel, you create new kamer1 to kamer4 too (look into your constructor)
ah I see, thanks! Any tips or ideas on how to make it so that it doesn;t create a hotel every time?
Ah i got it, just put it outside the do while loop. thanks guys for your help!