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 ]
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.
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
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
"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.
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.