--%>

Create an applet of bounces in JAVA

Create an applet that bounces a blue ball inside an applet using Thread.  The ball (diameter is 10) will start at position (0,0).  When the ball hits the edge of the applet, the ball should bounce off the edge at a randomly selected angle between 20 and 60 degrees  (Hint:  increase/decrease the x or y value by a random number of 2 to 6). Again, you must use the exact values that I stated in the questions to get credits.

More Hint:  When the ball hits the left edge (i.e. x <= 0), the x value should be increased.  When the ball hits the bottom edge, the y value should be decreased.

Bonus:  When the user click the mouse inside the applet, the ball will be suspended.  When the user click the mouse again, the ball will resume the motion but going in another direction.

 

 

   Related Questions in Programming Languages

  • Q : Why do I require TC Trustcenter

    Why do I require TC Trustcenter Publisher ID?

  • Q : Define the term Constant Define the

    Define the term Constant: A variable whose value might not be changed. In Java, such are implemented by the final variables.

  • Q : Define Number of Interleavings Number

    Number of Interleavings: Besides the raw number of threads, the state space is affected by the number of potential interleavings of these threads. While there exist automated techniques (partial-order reduction) to reduce these interleavings, most mod

  • Q : Passing by address or reference Passing

    Passing by address or reference: In this technique no separate memory build for formal variables that is, formal variables share similar location of actual variables and therefore any change on formal variables automatically reflected back to real var

  • Q : What is Syntax error Syntax error: It

    Syntax error: It is an error detected by the compiler throughout its parsing of a program. The syntax errors generally result from mis-ordering symbols in statements and expressions. Missing curly semicolons and brackets are general illustrations of s

  • Q : "Const" qualifier for pointers and

    In C++ an arguments to a function can be declared as constant as shown below:

    Q : Explain the purpose of using XML

    Explain the purpose of using XML.

  • Q : Define Java virtual machine or JVM

    Define Java virtual machine (JVM): A Java Virtual Machine (JVM) is an abstract computing machine, or virtual machine (set of computer software programs and data structures) which is a platform-independent execution environment that converts Java bytec

  • Q : Define the term Trusted applet Define

    Define the term Trusted applet: It is an applet with additional privileges than an ordinary (that is, untrusted) applet.

  • Q : What is an Arithmetic expression

    Arithmetic expression: It is an expression comprising numerical values of integer or floating point kinds. For example, operators like +, -, *, / and % get arithmetic expressions as their operands and generate arithmetic values as their outcomes.