Results 1 to 3 of 3

Thread: vending machine

  1. #1
    Timmy1596 is offline Member
    Join Date
    Sep 2011
    Posts
    1
    Rep Power
    0

    Default vending machine

    Hello i am trying to do a project for extra credit and i cant find out how to do what i want

    i want to somehow assign a string to have a value so when someone wants say koolaid to have a value of 42 and for it to minus that from the balance the user input say 100 so the vending machine asks to insert a coin and then says pick a drink and u say koolaid and it take the value of koolaid of 42 and minus it from 100 and the says remaining balance 52 i got most of the code but im not for sure how to assign it a value please help

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: vending machine

    What have you tried? You might want to have a look at the following:
    Java How to Program (stuck on homework? READ THIS BEFORE POSTING)

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,445
    Rep Power
    25

    Default Re: vending machine

    You could use a Map with the key being the product name and the value being its cost

Similar Threads

  1. Replies: 0
    Last Post: 02-07-2011, 01:27 PM
  2. 32 bit machine or 64 bit machine
    By Kapil Gupta in forum Advanced Java
    Replies: 13
    Last Post: 06-24-2008, 03:29 AM
  3. How to get URL from network machine
    By Mir in forum Networking
    Replies: 1
    Last Post: 04-02-2008, 12:08 AM
  4. Getting name/ip of a machine
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-02-2008, 07:11 PM
  5. Turing machine Help please!!
    By bladeb2k in forum Java Applets
    Replies: 1
    Last Post: 08-15-2007, 09:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •