1 Replies - 1153 Views - Last Post: 02 November 2006 - 12:33 PM Rate Topic: -----

#1 jjjx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 17-October 06

unsure of syntax needed

Posted 02 November 2006 - 06:55 AM

Hey,

Ive only been programming for 3 weeks so excuse the basic nature of the question. Im having one small problem with a part of a program I have to do.

basically its your bog standard boring vending machine thing and I have no problems with the majority of the code. But in this problem I have to have a class Dime to allow objects dime to be entered into the machine (that are stored in an array).

Anyway what I cant figure out is how to put in code that the price of my Pepsi is a number of 'dime' objects of the Dime Class.

Im pretty sure you cant do

costOfCan = 10 dime

If im missing something really obvious I apologise, i need someone to point me int he right direction.

I also need to be able to say that the (machine) balance is equal to the number of dimes.

Thanks for any advice.

Is This A Good Question/Topic? 0
  • +

Replies To: unsure of syntax needed

#2 XanFox  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 15-October 06

Re: unsure of syntax needed

Posted 02 November 2006 - 12:33 PM

Quote

Im pretty sure you cant do

costOfCan = 10 dime


you may not be able to do what you have written here but you could try:

costOfCan = 10 * dime


cheers
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1