This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Dice Program Desparate Help!!!

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have been given an assignment to produce a dice roll game in Java. I have also been given the dice class which I think is going to be used to display the dice images. The code for this is below:-





The game will consist of 24 dices shown on the screen in rows of 6 x 4 and then at the end of each row the program will calculate the number of dices that show the same value in a particular row.

Now I already know that I am probably going to have to use different classes for calculating and controlling the dice, but how do I link them together? I also need to use a harness class to start the program is this just a main & constructor in a seperate class?

The only other thing which i am very unsure about is what classes do i need and how can each component of the program be split up into each class?
If someone could draw me a rough uml diagram to explain this would be very helpful.

Thanks to everyone (in advance)

[ EJFH: Fixed code tags. ]
[ February 18, 2005: Message edited by: Ernest Friedman-Hill ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You really should not post the same question twice in the same forum, especially just 6 hours apart. We are all volunteers here, and tend to answer the more specific or interesting questions first. Your question is pretty vague, and has over 100 lines of code attached. Lots of people here won't even read a question if the attached code is more than 20-30 lines. If you are really desperate for help, you probably should sit down with your instructor. An explanation from them would help you to understand WHY you are designing things in a particular way better than a hastily drawn UML diagram from one of us.
 
Chris G Johnson
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have already tried that but this module is supposed to be about problem solving so they are not supposed to help. You're meant to get help from others or books. The main problem I am having is understanding the part Extends JButton
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it's about problem solving you're the one who's supposed to solve the problem.
You're not supposed to get someone else to solve it for you and then pass off that solution as your own.
That's what management school is about, not software development
 
Chris G Johnson
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are supposed to get others to help, you can use whatever resources you can find as this is defined as solving the problem.
 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"extends JButton" means that that class subclasses (inherits from) the javax.swing.JButton class. your textbook should have a section on inheritance, as part of its treatment of object-oriented basics; you might want to revisit that.

basically, it means that the class in question is the same thing as a JButton class but with a few added extras on top. what's written in the class in your code is these "added extras"; everything that was already in JButton is taken for granted, and you can go to the Java API documentation to learn about that part.
 
Chris G Johnson
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I use the class though, can I just create buttons from the class as normal and use the inherited methods?
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chris G Johnson:
How do I use the class though, can I just create buttons from the class as normal and use the inherited methods?



Yes, you can. In fact, that's basically how I would approach this. Why don't you write some of your own code and post more specific questions here? I think it will help this conversation if you show us exactly what you have tried on your own.

Layne
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic