Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How to approach '40cent vending machine that return change' interview question?

Status
Not open for further replies.

morris_mano

Full Member level 2
Joined
Apr 9, 2012
Messages
137
Helped
39
Reputation
78
Reaction score
41
Trophy points
1,308
Location
US
Activity points
2,757
I was asked in an interview, how would you design a vending machine that accepts nickel, dime and quarter, and output a product after the total coin value reaches 40 cent and also return a change if total coin value exceeds 40cent. The change can be in any combination of nickel, dime and quarter.

I designed this vending machine later and tested it. It works. Basically it had 3 submodule: coin_adder, vending_fsm and coin_change.

If you were asked the same question, what would be your approach to answer it. Will you show block diagram of different sub blocks first and draw state graph for each sub-blocks and explain the procedural blocks inside, or..?

It will help other people and myself in how to give the best answer, if asked in interview next time.

Thanks,
 
Last edited:

In order to start any design, write down all assumptions into a "Spec" so you and others know what you forgot to assume or assumed wrong. Define Scope or boundary of spec, environment limits, inputs , outputs, process behaviours (time delay, verification) , user feedback outputs, , fault tolerance and detection, fault recovery and power initialization in order to define more "States" which you overlooked. :razz:
 

I agree with "Spec" part, but this was an interview question. I am not sure what interviewer was expecting in the answer. It would be helpful to see how people approach the reply to this interview question as if it were during the interview.

As for the assumption, I assumed there are 3 inputs for each coin, which will be asserted for 1 clock cycle after coin has been inserted. Even though the interviewer asked for a single item, I still think we will need item select switch. Item will not be release if this switch is not pressed even after total value exceeds 40cent . If the user does not want the item and want the money back, simply press the cancel switch. In that case, all the inserted coin will be returned. If the user press the item select switch without having 40 cent in the machine, the error is asserted which can be used to display " not sufficient fund". For change return, it was assumed that to return nickel, dime and quarter, COIN_O[0],COIN_O[1] and COIN_O[2] need to be asserted for 1 clk cycle respectively. The product will be released when VEND_O is asserted for 1 clk cycle. I know there are many more requirements or "spec" for complete design like response delay and fault tolerant but during interview process, to simplify you can reply without those constraints. I have shown my module description below:

module vending_top(
input CLK_I,
input RST_N_I,
input NICKEL_I,
input DIME_I,
input QUARTER_I,
input SEL_ITEM_I,
input CANCEL_I,
output VEND_O,
output [2:0] COIN_O,
output ERROR_O);​
 

If I asked someone a design question, I would expect a broader solution 1st, because too many people get into implementation specific solutions before knowing what the assumptions are. Such as assumptions and specs. By asking the question at least clarifies what assumptions can be neglected. But design has many levels not just the basic function and depends what interviewer expects.
 

your solution was good. My suggestion is start with all the inputs and outputs in a block diagram to show functional blocks and then show possible implemenation using purchased modules to satisfy inputs. Also define requirements for acceptance criteria so design can be measured against this unwritten requirement... e.g. reject false coins, accept good coins of all vintage.. test accuracy of OEM modules to verify meet expectations...Define overall agency approval requirements .. packaging, safety,, user interface , appearance, cost issues as undefined design requirements....reliability.. this total solution thinking shows depth and breadth of experience, even if assumption was stated waht was NOT included in the design but requires specs. to ensure suitability of end result... So many millions of dollars in R&D have been wasted I have seen because Managers failed to define proper design specs and the designers end up frustrated when they find surprise requirements change the whole design becuase no one thought about the,.. At the beginning is the best time to do this... not after..... really hundreds of milllions of dollars in R&D at companies I have worked for failed due to poor specs. And the ones that were more successful had the best specs.

- - - Updated - - -

I remember fake money getting accepted in vendor machines because it was not designed to include all the latest security counter measures for fake money detection systems. Not just a design flaw but a flaw in the specs and not tested to specs after design.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top