mercredi 21 juillet 2021

Java searching for a right pattern

There is the next task I have :

Create an application that represents a Taxi station with 10 taxies. Taxi station enables: -Order taxi -Cancel taxi -Be aware when taxi gets available A person that orders a taxi may be a regular customer or a VIP customer. If a VIP orders a taxi, he/she should be first in line regardless of the time he requested the service. Where no taxi is available, a person should be kept on the waiting list. When a taxi becomes available, a person according to priority gets the free taxi. Print to console every reservation accepted/queued. Execute:

  1. Create a taxi station with 10 taxis
  2. Order a taxi for 9 regular persons
  3. Order a taxi for 1 VIP person
  4. Order taxi for 2 regular person
  5. Order a taxi for 1 VIP person
  6. 1 Taxi is back in the station
  7. Order a taxi for 1 VIP person
  8. the Second taxi is back at the station
  9. Third taxi is back at the station

So, the question is: Which design pattern fits the most to this task? How would you solve this case? Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire