Pergunta de entrevista da empresa Amazon

Design a parking lot kiosk.

Respostas da entrevista

Sigiloso

30 de dez. de 2010

Software development is about finding the balance between various desired qualities of programs that often come at the expanse of each other. For example, efficiency often comes at the expanse of development time and code complexity. In real world situation, I would begin the design process by thoroughly understanding requirements. I would seek the answers to questions like: -What's the capacity of the parking lot? -What's the avg/max/variance of the rate of vehicle input? output? -What's the tolerance for traffic jam at entrance? exit? -Who are the users? Are they regulars or use the lot only once? -How many entrances? Exits? -What's the devel time requirmenment? -Is this code a one-off or be reused? Since this is just an interview, I'll assume that this parking lot has 100 spots, one entrance, which is also the exit and that the input/output rates are low enough that traffic jams are non-issue. When the vehicle enters, the ticket booth issues a time-stamped ticket to the vehicle. When the vehicle leaves, the ticket booth accepts the ticket, notifies the vehicle of the costs and accepts payment. It assumes well behaved drivers that always pay correct amount with exact change. class TicketBooth{ public: Ticket onVehicleEnter(); Price onVehicleExit(Ticket); void acceptPayment(Money); }

1

Sigiloso

22 de dez. de 2010

Here is what is on my minde. Design: Check-in and Check-Out, Payment module. Check-in and Check-out is used to get check-in time, check-out is used to validate the payment. Payment Module - will contain, verifying the ticket, calculating stay time, validating the credit card / accepting cash, rendering change etc, and charging the amount and giving back the charged ticket successfully. We can define each of the above functionalities into different classes/ methods. If anyone thinks has a better solution please post.