Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
HELP! no idea how to do this.. Posted by 64101030 on 14 Nov 2011 at 7:19 AM
I just got this assignment..im in a basic programming class and am totally unprepared...does anyone know how to program this??



Create a page containing four image tags, two buttons, a <select> and a <textarea>. The images tags will each contain a picture of one of six possible outcomes for the dice portraying the numbers one through six..

The first button: When the user clicks on the button, all dice are rolled once. For each die when rolled, the src of its image tag is replaced with a random one of six possible pictures -- each picture being chosen with equal probability (1/6).

The select: The user may select any of the numbers one through six. Whenever a picture is clicked upon, then that die takes on the value shown inside the <select>.

The textarea: Results of the dice rolls should be kept as a running log (a cumulative history) in a textarea at the bottom of the page. With each roll (initiated by the click of the button), we should be able to see the complete history of all current and previous dice rolls. You need not consider changes brought about clicks on individual dice in conjunction with the <select>

The second button: A button below the textarea, should allow the user to obtain a report (overwriting the current contents of the log in the textarea) which tabulates the frequency of each of the six outcomes plotted separately for each of the dice. The frequency tabulation should show how often each die was rolled, as consistent with the data stored in the log.
Report
Re: HELP! no idea how to do this.. Posted by MasterMind555 on 14 Nov 2011 at 5:46 PM
"...does anyone know how to program this??"
Yes

Ok so, you'll need to make a JFrame with all what you listed there, then make the 6 pictures, and load them and store them into a variable.
Then very easy, just an little help from the Random Class and you'll be good to go.



--------------------------------------------------------
Life is like a s**t sandwich, each day, you eat a good mouthful of it...



 

Recent Jobs