It is my final assinment to create a program similar to yahtzee. I need it to roll 6 dice visually. Allow the user to keep the dice they want to save. And after three rolls select a place to save their number value. At end of program, it should tally up total score and display. I have been reading on interent for around a week, going over Dan Siedman's work, Reading my textbook, researching other works over arrays, but i have come to the conclusion that I am bogged down, and dont have a clue what to do. I have 5 days left to finish up the program, Ive flowcharted what it needs to do, I started the code like 5 times and scrapped it, asked around to fellow students(who are also not going to finish the project imo, theres only 5 of us)I am not a strong programmer by nature, I did very well in cobol and vb, I finished out c++ by a hair, and java is like reading heiroglyphics basically to me. I read and re-read the chapters, but it just doesnt click. My textbook we use is supposedly not a very good one(Java Programming: complete Concepts and Techniques, only over chapters 1-6) My idea that im stuck at is as follows for those who are still reading
1. Create the dice(I still havent figured out how to visually make six dice, dice[5])
2. Make a button that rolls the dice using math.random
3. Store the dice in an array(scores[6])
3. Have six textfields with labels next to them that read 1's, 2's, ect.
where the user can click to save the dice total, place in the scores [5] array.
4. A total score textfield(scores[6]) that after all previous scores have been recorded shows the total of all scores.
5. A "play again" button that repaints the progrom to blank
6. an exit button that closes the program


If someone could help me out, I would be greatful. I have no problem in doing the work, but I am completly defeated and in a best case scenario if i could pull my grade in his class from a 68 to at least passing, I would be doing very well. I have discovered that I do not want to be a programmer(kinda late for that now lol) but with financial descions and me almost being finished I am stuck with this degree plan. My real passion is for fixing computer problems either hardware related or software related, and I imagine I can get a job in IT somewhere if i can finish my degree. (my school has jobs opening up and I am in the process of trying to land one) thanks for reading

That's a fairly advanced project for someone new to Java. But I do have a suggestion to help get you going...

It sounds like this app requires a GUI. I would suggest you build the GUI first... forget about the logic for the dice, etc for now. First build the GUI with the buttons you need. That alone will probably get you half credit.

Once you have the GUI you will, for the most part, have much of your logic (including dice logic) in your Action Listener code. When someone clicks a button the Action Listener code will be called. You can find out more about Action Listeners here...

http://java.sun.com/docs/books/tutorial/uiswing/events/actionlistener.html

I also suggest using the Math.random method for your dice rolls.

Hope this helps!

Tyster

There are a few URLs: These will help your project.
http://math.hws.edu/javanotes/c6/ex4-ans.html
http://www.csd.abdn.ac.uk/~etadjoud/teaching/CS5536/information/notes-java/45examples/30graphics/40roll_dice/10roll_dice.html
http://www.antionline.com/archive/index.php/t-228926.html


Albert

I suggest Albert to you to not point such members to a direct solution such as these. I went through the links and all of them provide a ready-made solution. I would not be surprised if the original poster just copy-pastes the solution and submits the assignment, which certainly was not what the assignment giver was hoping for. What people would not understand is that assignments are for them to understand the process of program development rather than for mere completion. Such spoon-feeding would eventually paralyze their career as a developer. I hope you understand this and do not repeat this.

This article has been dead for over six months. Start a new discussion instead.