Re: [Tutor] Vending machine program

2013-01-05 Thread bob gailer

On 1/4/2013 8:26 PM, Alan Gauld wrote:

On 04/01/13 17:47, bob gailer wrote:


 Further selections can be made if there is enough credit.

This is confusing. You could drop that line with no ill effect. I am not
sure what it even means.


It seemed straightforward enough to me Bob.
If you put in $10 and buy a candy bar for $6 you have $4 credit left.
You can then choose another item provided it costs less than $4.

It just implies another level of loop in the design.

OK I get it.


In fact given the detail of the spec its hard to see what we could add 
by way of help until the OP produces some code to critique.





--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Vending machine program

2013-01-04 Thread Ghadir Ghasemi
H I wanted to create a program called vending machine and I wondered if you 
could do it so I can find out how to do it.
Here is how it should work like:

A food vending machine accepts 10p, 20p, 50p and £1 coins.
One or more coins are inserted and the current credit is calculated and 
displayed.
A product is selected from those available. The system checks to see if there 
is enough credit to purchase the product chosen.
If there is not enough credit the system displays an error message.
If there is enough credit it dispenses the product, updates the credit 
available and displays the remaining credit.
Further selections can be made if there is enough credit.
The vending machine simulation should have five products and prices. Design, 
code, test and evaluate a program for this simulation.

Thank you
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Vending machine program

2013-01-04 Thread Hugo Arts
On Fri, Jan 4, 2013 at 12:34 PM, Ghadir Ghasemi 
ghasemm...@leedslearning.net wrote:

 H I wanted to create a program called vending machine and I wondered if
 you could do it so I can find out how to do it.


No. This list is meant to help people with specific questions about their
python programs. If you make an attempt at writing this program and get
stuck or have questions on how to proceed, we will be happy to give you
hints and help you out. But we won't do your work for you.

Hugo
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Vending machine program

2013-01-04 Thread bob gailer

On 1/4/2013 6:34 AM, Ghadir Ghasemi wrote:

H I wanted to create a program called vending machine and I wondered if you 
could do it so I can find out how to do it.
Here is how it should work like:

A food vending machine accepts 10p, 20p, 50p and £1 coins.
One or more coins are inserted and the current credit is calculated and 
displayed.
A product is selected from those available. The system checks to see if there 
is enough credit to purchase the product chosen.
If there is not enough credit the system displays an error message.
If there is enough credit it dispenses the product, updates the credit 
available and displays the remaining credit.
Further selections can be made if there is enough credit.
The vending machine simulation should have five products and prices. Design, 
code, test and evaluate a program for this simulation.
Where did you get this assignment? What prior programming experience do 
you have?


As already mentioned we prefer to not do your work for you.

Further selections can be made if there is enough credit.

This is confusing. You could drop that line with no ill effect. I am not 
sure what it even means.


How far did you get in the steps suggested? Did you attempt a design?

--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Vending machine program

2013-01-04 Thread Mitya Sirenef

On 01/04/2013 06:34 AM, Ghadir Ghasemi wrote:
H I wanted to create a program  called vending machine and I wondered if you could do it so I can find 

out how to do it.
 Here is how it should work like:

 A food vending machine accepts 10p, 20p, 50p and £1 coins.
 One or more coins are inserted and the current credit is calculated 
and displayed.
 A product is selected from those available. The system checks to see 
if there is enough credit to purchase the product chosen.

 If there is not enough credit the system displays an error message.
 If there is enough credit it dispenses the product, updates the 
credit available and displays the remaining credit.

 Further selections can be made if there is enough credit.
 The vending machine simulation should have five products and prices. 
Design, code, test and evaluate a program for this simulation.


 Thank you
 ___
 Tutor maillist - Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



I would suggest a general design with VendingMachine class with these
properties:

 - product list (if you don't need to handle running out of products)
 - credit (int, in pence)
 - method to list products and credit
 - method to add to credit
 - method to buy a product

A separate class that handles user interface: main loop, accepting the
commands: add amount, select product; a method that runs continuously
until a valid command is provided  then the command is returned. In the
main loop, products are listed, user provides the command, command is
delegated to one of VendingMachine methods and then loop goes back to
the beginning.

Hope this helps,  -m




--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Vending machine program

2013-01-04 Thread Alan Gauld

On 04/01/13 17:47, bob gailer wrote:


 Further selections can be made if there is enough credit.

This is confusing. You could drop that line with no ill effect. I am not
sure what it even means.


It seemed straightforward enough to me Bob.
If you put in $10 and buy a candy bar for $6 you have $4 credit left.
You can then choose another item provided it costs less than $4.

It just implies another level of loop in the design.

In fact given the detail of the spec its hard to see what we could add 
by way of help until the OP produces some code to critique.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor