- "description_text" : "Your first task will be to create the basic models for this project.\n\nWe will need a [Human.java](course://Course/Models/src/org/togetherjava/event/elevator/humans/Human.java)\nfile, that represents the individual humans who want to use elevators to travel around.\n\nAnd an [Elevator.java](course://Course/Models/src/org/togetherjava/event/elevator/elevators/Elevator.java)\nfile, which will transport humans along the floors.\n\n## Human\n\nWe start with the [Human.java](course://Course/Models/src/org/togetherjava/event/elevator/humans/Human.java).\n\n### State\n\nBefore we begin with the class itself, we need an enum that represents the `State` of a human.\nHumans are supposed to be in either of the following states:\n\n* `IDLE`\n* `WAITING_FOR_ELEVATOR`\n* `TRAVELING_WITH_ELEVATOR`\n* `ARRIVED`\n\nPlease adjust the given enum accordingly to have those 4 states.\n\nAlso, a human will need to keep track of their `currentState`.\nPlease add such a **field** to the class. The `getCurrentState()` method is supposed to return this field.\nThe field itself can be kept on the `IDLE` state for now, but will eventually be able to change.\n\n### Floors\n\nNext up, humans need a `startingFloor` and a `destinationFloor`.\nFor this project, we will assume that the first floor in a building is floor `1` (and not `0`).\n\nThe human is supposed to take in those two values via constructor and remember them in fields,\nfrom where it can then serve them to users with `getStartingFloor()` and `getDestinationFloor()`.\n\n### Elevator ID\n\nA human needs to be able to keep track of the elevator they are currently in, if any.\nElevators have unique IDs and the `getCurrentEnteredElevatorID()` method is supposed to return\nthat respectively, or an empty optional if the human is on the corridor.\n\nThe logic for this method could be backed by a field, it is your choice how to implement it.\n\nFor now, we will not change the value of this yet though and the method can just\n`return OptionalInt.empty()`.\n\n### `toString`\n\nTo ease debugging, it is highly recommended that you add a `toString` method to your `Human` class.\n\n## Elevator\n\nThe next class to focus at is [Elevator.java](course://Course/Models/src/org/togetherjava/event/elevator/elevators/Elevator.java).\n\nSimilar to `Human`, you will have to add a couple of fields, set up by the constructor.\n\n### Floors\n\nAn elevator has a range of floors that it can serve. The range is defined by the\n`minFloor` (at least greater equals `1`), ranging up to the last supported floor, given by\n`minFloor + floorsServed - 1`.\n\nIn might sound complex at first, but is actually simple once we take a look at some examples.\nSuppose an elevator with:\n\n* `minFloor = 3`\n* `floorsServed = 4`\n\nThis elevator supports floors `3, 4, 5, 6`. So the range starts at `3` and the total\namount of floors served is `4`, making it end at floor `6`. We assume no gaps in this range,\nelevators support all floors on their range.\n\nOn top of that, an elevator also has a starting position, indicated by `currentFloor`.\n\nImplement the constructor and the corresponding methods.\n\n### ID\n\nEach elevator needs a unique ID. This ID is supposed to be returned by `getId()`.\n\nNot only will this be useful for debugging later on, but this ID will also be displayed later\nin the visualization. For the best experience, it should be positive and start small.\nFor example `0`, `1`, `2` and so on.\n\nHow you implement this, is up to you.\n\n### `toString`\n\nLikewise to `Human`, it is highly recommended that you add a `toString` method to your `Elevator` class.\n\n## Test\n\nLatest at this point, you should actually head over to [Main.java](course://Course/Models/src/org/togetherjava/event/elevator/Main.java)\nand try out your classes. See if everything works as expected, play around with it.\nFor example, write something like:\n\n```java\nHuman human = new Human(1, 4);\n\nSystem.out.println(human.getCurrentState());\nSystem.out.println(human.getStartingFloor());\nSystem.out.println(human);\n\nElevator elevator = new Elevator(3, 4, 6);\n\nSystem.out.println(elevator.getId());\nSystem.out.println(elevator.getFloorsServed());\nSystem.out.println(elevator);\n```\n\nAt this point, if you have done everything right, all tests should pass, and you can move on to\nthe next section \uD83D\uDC4D\n\nIf you have put your implementations into the highlighted placeholder-areas,\nyour code should carry over automatically.\n",
0 commit comments