Note that there are some explanatory texts on larger screens.

plurals
  1. POHaving a hard time determining the starting point of my design
    primarykey
    data
    text
    <p>For my CS course I have to program a hotel checkin/checkout system. The program must be able to check people in and out. The programm assigns the first available room to a guest upon checkin. If no room is free, it will say so as well. The Hotel has four rooms. </p> <p>In the assignment it says there need to be 4 classes: Assignment5, Hotel, Room, &amp; Guest.</p> <ol> <li><p>Assignment5 class is for the interaction with the user.</p></li> <li><p>Hotel class has four rooms and all methods for operating the rooms.</p></li> <li><p>Room class has 1 guest. If the rooms is empty a guest can check in. If the guest is leaving the room needs to be emptied.</p></li> <li><p>Guest class: the guest has a firstname and a last name.</p></li> </ol> <p>In the menu there need to be 4 options: 1 show status of rooms available and occupation. 2 check in option 3 check out option 4 end program option.</p> <p>OK, so I know I should make my assignment for myself. However, I don't know what it is, but starting with assignments I have great problems cutting the thing up in smaller pieces. Also this assignment is to learn working with different classes and I don't really understand which sequence of steps i should take in this case.</p> <p>Can someone help me getting started by giving some tips? Have been staring at my screen for hours now and just thought I could use some little insights to get me started. Any help is greatly apprecieted!</p> <p>OK thnks for the help so far. </p> <p>*<strong>*First of all, MANY thanks for all your help, you guys are great! Have been at it for 7 hours straight now and still stuck. My problem now is that it doesn't compile. It says:</strong> </p> <pre><code>Java:28: checkIn(Gast) in Hotel cannot be applied to (java.lang.String) hotel.checkIn("Guido"); ^ 1 error </code></pre> <p>And maybe, can someone look if this way i put it now is a little bit on the right path? I do thank JavaGeek for his program, but i want to learn it by doing myself.</p> <p>up until now I have the following:</p> <pre><code> import java.util.Scanner; public class bopgave5 { public static void main(String[] args) { boolean opnieuw = false; do { int invoer = menu(); if (invoer == 2){ Hotel hotel = new Hotel(); hotel.checkIn("Guido"); opnieuw = true; } else if (invoer == 4) opnieuw = false; else opnieuw = true; } while (opnieuw == true); } public static int menu (){ Scanner sc = new Scanner(System.in); System.out.println("MENU: [1] Statusoverzicht"); System.out.println(" [2] Check-in"); System.out.println(" [3] Check-out"); System.out.println(" [4] Einde"); System.out.print("Uw invoer: "); int invoer = sc.nextInt(); return invoer; } } class Hotel { Kamer kamer1, kamer2, kamer3, kamer4; Hotel (){ kamer1 = new Kamer(); kamer2 = new Kamer(); kamer3 = new Kamer(); kamer4 = new Kamer(); } void checkIn(Gast nieuweGast) { if (kamer1.gast == null) { kamer1.gast = nieuweGast; System.out.println("Gast " + nieuweGast.naam + " krijgt kamer 1"); return; } else if (kamer2.gast == null) { kamer2.gast = nieuweGast; System.out.println("Gast " + nieuweGast.naam + " krijgt kamer 2"); return; } else if (kamer3.gast == null) { kamer3.gast = nieuweGast; System.out.println("Gast " + nieuweGast.naam + " krijgt kamer 3"); return; } else if (kamer4.gast == null) { kamer4.gast = nieuweGast; System.out.println("Gast " + nieuweGast.naam + " krijgt kamer 5"); return; } else { System.out.println("hotel is vol"); return; } } } class Kamer { Gast gast; Kamer() { gast = null; } } class Gast { String naam; Gast(String nieuweNaam) { naam = nieuweNaam; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload