dice program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hitchlloyd
    New Member
    • Dec 2007
    • 3

    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 .
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by hitchlloyd
    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?

    Comment

    • hitchlloyd
      New Member
      • Dec 2007
      • 3

      #3
      import java.awt.*;
      import java x.Swing.*;
      import java.awt.event. *;
      import java.aplet;
      importjava.appl et.applet;impor t 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",Fo nt. BOLD,20);

      screen2D.set Font(f);


      screen 2D. draw String(result Text.200,200);
      result Text=""
      }

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by hitchlloyd
        import java.awt.*;
        import java x.Swing.*;
        import java.awt.event. *;
        import java.aplet;
        importjava.appl et.applet;impor t 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",Fo nt. 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.

        Comment

        • hitchlloyd
          New Member
          • Dec 2007
          • 3

          #5
          Originally posted by r035198x
          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]

          Comment

          Working...