Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Slot Machine  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been given a piece of coursework to do using random numbers. I have decided to do a slot machine for it. I am having trouble and would like help so that the result either adds 2 pound on to there money if they win or takes one off if they lose. I also would like a loop so that when they have no money left they can not play.


Any help you could give would be greatly appreciated

EDIT by mw: Added Code Tags.
[ March 20, 2007: Message edited by: marc weber ]
 
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by ant williams:
...would like help so that the result either adds 2 pound on to there money if they win or takes one off if they lose...


Welcome to JavaRanch!

You already have a field called "money," and you have an if/else condition for determining whether the player wins or loses. So what would make sense here? Do you have any ideas about how to approach this?
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!