Question: Implement a system simulating a ferry boat that makes trips with several stops. The ferry has only one opening on the front, which is used

Implement a system simulating a ferry boat that makes trips with several stops. The ferry has only one opening on the front, which is used for embarking and disembarking cars and motorbikes. The lower deck of the ferry is used for parking cars. It is horseshoe-shapd, meaning that the emarking cars get in through the opening, drive along the lower deck until the end and find themselves facing the opening from the inside. The lower deck is very narrow so the cars must leave in the same order as they got in. If a car in the middle has to disembark, each car in front of it will leave the lower deck and reenter it immediatly from the embarking side. The upper deck is used for parking motorbikes. It is straight and very narrow, meaning that the first motorbike to get in is the last one to get out. In case a motorbike in the middle has to disembark, the motorbikes standing in front of it are temporary stocked in the maneuver deck, then moved back to the upper deck such that they are in the same order as before. In the text of the exercise, it is not specified whether you have to use a Stack or a Queue to implement the lower Deck, the upperDeck, and the maneuverDeck. You must choose which of the two sequence types is the suitable one by replacing Sequence with Stack or Queue in your implementation. Only use the methods described in the "Data Structures for Sequences" section above! Cars and Motorbikes are both modeled as a String contraing the license plate. Do not forget to replace car and motorbike with the respective license plates in the text you print. 1. Create a new Java project and add a package named "exercise" in it (you should not have problems doing this by now, if you have troubles take a look at the previous sheets) 2. Create a class Ferry containing the following: (a) a private attribute Sequence
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
