This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Help with Slot Machine program in Java

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. In my computer science class, we have an assignment to make a Slot Machine with objects but I'm having some trouble. I already got a lot of it done but I'm not really sure where to go from here. Can someone please help? Below are links to the two .java files on PasteBin and a link to a PDF of the project rubric in google drive. Thanks for the help in advance!

https://pastebin.com/sDwMFQiG slotmachine.java
https://pastebin.com/EWFJKg87 SlotRunner.java
https://drive.google.com/file/d/1XEXjHYIc51C9KSvcLasrlTm5r3j3a1GX/view?usp=sharing Slot Machine Rubric
 
Saloon Keeper
Posts: 6796
64
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please cut and paste the code into a post, and UseCodeTags (<-link).

What's the program supposed to do when you run it?
 
Sheriff
Posts: 14767
245
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

You said you got a lot of it done, please show us exactly what you got done.

 
Ryan Sinh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What the code is supposed to do is create a 3 reel, 6 icon slot machine in two classes that utilize objects that, when ran, will say something like "spin x: orange grape cherry, you lost" It will keep running until you win. to win, you have to have all 3 reels be the same ex."spin x: cherry  cherry  cherry, you won" and then stop running. For this, there are 2 files, SlotRunner, which will utilize the SlotMachine class and spit out the values of the 3 reels/tell me whether or not I won, and the SlotMachine class is what contains most of the code that actually does stuff. What I've done so far is setup the 2 classes like my CompSci teacher asked and tried adding some stuff of my own. Although most of what I've done hasn't worked. I would have just asked my CompSci teacher but he sent out an email a few hours ago saying he's out sick but to still work on the Slot Machine stuff. I already said the basic needs for the Slot Machine but Here's the actual rubric. https://drive.google.com/open?id=1XEXjHYIc51C9KSvcLasrlTm5r3j3a1GX I don't really need help with part b of the rubric because i don't really plan on doing it. I just need to get at least a 70 on the assignment.

The Slot Machine runner class:

The actual Slot Machine Class
 
Carey Brown
Saloon Keeper
Posts: 6796
64
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, it seems like you need to be able to display one spin as a starting point. What are you missing in order to do that?
 
Junilu Lacar
Sheriff
Posts: 14767
245
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks like the starter code you were given. None of the parts that the student is supposed to do have been done. You should know that this site exists to help people learn. That means we don't allow anyone here to provide solutions for you to pass for your own work. We'll only help you work through any problems you encounter as you try to solve the problem yourself, with code that you wrote yourself.

So, what are having trouble with?
 
Carey Brown
Saloon Keeper
Posts: 6796
64
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general development work flow, you pick a small starting point, implement it, get it to compile, get it to run, and test it till it works, BEFORE going on to adding the next piece. I notice many places that won't compile in your code so it seems you haven't followed this process. You may need to start over and select only one of the basic methods and go through the steps till it's completely debugged.
 
And then the flying monkeys attacked. My only defense was this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!