Amazon Interview Question for Software Engineer / Developers


Country: United States
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
1
of 1 vote

I would use State Pattern to design a vending machine. I see this example in Head First in Design Patterns

- Collections.solutions() April 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Classes are:
1) Can alignment
2) Money
3) Button system
4) Accept card system

- Surya April 16, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Concepts in System:

1. Machine
2. Item
3. Money
4. Keypad
5. ItemPicker
6. ColumnPusher
7. MoneyValidator / Counter
8. ItemSlot
9. Payment
Classes:

1. Machine
2. Item
3. Money
> Bill ($)
> Coin
4. Keypad
5. ItemPicker
--- lock/unlock
--- pushColumn

6. MoneyValidator / Counter
>> CashValidator
>> CardValidator

8. ItemSlot
9. MoneySlot
>> CashSlot
>> CardSlot

9. Inventory
key, Stack<Item>
key => ItemSlot

10. KeypadInterface
---- understand the payment mode, and call Validator and Payment classes
---- Validate the valid itemSlot and item is available or not

11. Can use Command Pattern to execute the command from user.
VendingCommand => SlotNumber
execute(..) =>
a. Will do the do the payment
b. Instruct ItemPicker ( provide the slot using
inventory)
c. Update the inventory
d. and say Cheers :)

---- Dev 2.0

- Developer2.0 May 09, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

but, there is no state pattern mentioned in design.

- cthecool July 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More