473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

dice program

Hi , i will like to Design, Implement and test an Applet that will simulate throwing a die(dice).

Initially, the GUI displayed by the applet will show a button. Once this button is pressed, a random integer in the range 1 to 6 (representing the six faces of a die) will be generated. Having determined the number which has been generated once the button is pressed, the program should:




Play the sound of throwing a die.

Display an image of the face of a die.

Play a sound clip announcing a throw. For Example, for 4, the sound clip should say “You have thrown three”.
REMEMBER PROGRAM SHOULD BE IN SUCH A WAY THAT IT CAN BE RUN IN TEXT PAD
i will be glad if you could get back to me soo .THANK YOU .
Dec 4 '07 #1
4 3131
r035198x
13,262 8TB
Hi , i will like to Design, Implement and test an Applet that will simulate throwing a die(dice).

Initially, the GUI displayed by the applet will show a button. Once this button is pressed, a random integer in the range 1 to 6 (representing the six faces of a die) will be generated. Having determined the number which has been generated once the button is pressed, the program should:




Play the sound of throwing a die.

Display an image of the face of a die.

Play a sound clip announcing a throw. For Example, for 4, the sound clip should say “You have thrown three”.
REMEMBER PROGRAM SHOULD BE IN SUCH A WAY THAT IT CAN BE RUN IN TEXT PAD
i will be glad if you could get back to me soo .THANK YOU .
So which part do you need help in?
Have you done anything yet?
Dec 4 '07 #2
import java.awt.*;
import java x.Swing.*;
import java.awt.event.*;
import java.aplet;
importjava.applet.applet;import java.io.*;
public class finalRoll extads JApplet impliments Action Lister
Audio clip joy;
Audio clip a;
Audio clip b;
Thread timer = null
int value=0
Die diel= newDas

final String u="1"

final string v="2"

final string w="3"

final string x="4"

final string y="5"

final string z="6"

string result Text="";
T Button rollButton=new T button
public void inot
public static void Paint
graphics 2D screen 2D=(graphics 2D) screen
die1.draw Die(screen 2D,90F,80F);
front f =new font("helvetica",Font. BOLD,20);
screen2D.set Font(f);
screen 2D. draw String("you have thrown:"5.220);if(result Text!="");
{
f=new Font ("helvetica",Font. BOLD,20);

screen2D.set Font(f);


screen 2D. draw String(result Text.200,200);
result Text=""
}
Dec 6 '07 #3
r035198x
13,262 8TB
import java.awt.*;
import java x.Swing.*;
import java.awt.event.*;
import java.aplet;
importjava.applet.applet;import java.io.*;
public class finalRoll extads JApplet impliments Action Lister
Audio clip joy;
Audio clip a;
Audio clip b;
Thread timer = null
int value=0
Die diel= newDas

final String u="1"

final string v="2"

final string w="3"

final string x="4"

final string y="5"

final string z="6"

string result Text="";
T Button rollButton=new T button
public void inot
public static void Paint
graphics 2D screen 2D=(graphics 2D) screen
die1.draw Die(screen 2D,90F,80F);
front f =new font("helvetica",Font. BOLD,20);
screen2D.set Font(f);
screen 2D. draw String("you have thrown:"5.220);if(result Text!="");
{
f=new Font ("helvetica",Font. BOLD,20);

screen2D.set Font(f);


screen 2D. draw String(result Text.200,200);
result Text=""
}
1.) Use code tags when posting code.
2.) You still haven't unswered my first question.
Dec 6 '07 #4
1.) Use code tags when posting code.
2.) You still haven't unswered my first question.
when i run the program in text pad it dosen't work. thats where i need your help
[quote=r035198x]
Dec 7 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Tomi Lindberg | last post by:
Hi, I'm trying to find a way to calculate a distribution of outcomes with any combination of dice. I have the basics done, but I'm a bit unsure how to continue. My main concern is how to make...
4
by: Richard Buckle | last post by:
Hi fellow Pythonistas, I've been using Python in anger for some time, and I must say, as I wrote in <http://macprang.sourceforge.net/>: "It's refreshing beyond words to use a language that so...
101
by: Elijah Cardon | last post by:
Let's say I have m dice having n sides, such that n^m is not going to bust int as a datatype. With m=4 and n=6, an outcome might be {2, 5, 1, 2}. What is a good way to represent this in c so that...
2
by: DeFault | last post by:
I have this assigment to do that determines which of three dice are loaded. The dice are actually three C functions called dieA(), diaB(), and dieC()each of which returns an int in the range 1 – 6...
0
by: Bree | last post by:
The game requires it not to accept negative numbers. At the moment it isnt, and it is urgent I find the solution asap. So if anyone can help I would much appreciate it. Thanks Bree This is the...
1
by: lenest | last post by:
I need help writing a program.... You are to write a python program to accomplish the following: a.. Play a dice game of Craps using a random number generator to simulate the roll of the...
38
by: d0ugg | last post by:
I'm writing a program that will have to roll the dice A and dice B one million times, and calculate the percentage of times that the dies will be equal. I'm having trouble to figure out how the...
4
by: clairelee0322 | last post by:
Hello guys again! I am a C++ beginner and I am working on another project.. It's called Dice Lab with Loops.. unforunately I don't even know how to start the program.... Don't blame me for not pay...
2
by: sunnydude | last post by:
Anybody know how to write a 3 dice rolling program like this Sample output Welcome to the dice roller! First of all, please enter a seed for the random number generator. This should be a...
1
by: clairelee0322 | last post by:
I am a c++ beginner and i am working on a dice loop lab. This program should roll two dice (each dice is from 1 to 6) and then total them together. The user should be able to input how many times...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.