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 : What is SLAM SLAM is a Microsoft

    SLAM is a Microsoft project that blurs the line between static analysis and model checking and deductive reasoning. The main goal of SLAM is to check temporal safety properties of C programs (it actually checks that a program correctly uses the interf

  • Q : Define Fully evaluating operator Fully

    Fully evaluating operator: An operator which computes all of its arguments to generate an outcome. Standard arithmetic operators, like +, are totally evaluating. In contrary, some Boolean operators, like &&, are short-circuit operators.

  • Q : Explain the difference between RAM and

    Explain the difference between RAM and ROM?

  • Q : Define Bogor Bogor (Robby, Dwyer, and

    Bogor (Robby, Dwyer, and Hatcliff 2006) is an extensible software model-checking framework which includes: Software model checking algorithms Visualizations A user interface designed to

  • Q : What is Protected access Protected

    Protected access: Protected access is accessible to a class member prefixed with protected access modifier. This member is accessible to all classes stated within the enclosing package, and any sub-classes expanding the enclosing class.

  • Q : State De Morgans Theorem De Morgan's

    De Morgan's Theorem: The two rules which can help to simplify Boolean expressions comprising multiple logical-not operators in combination with the other Boolean operators.

  • Q : Explain Multiple inheritance Multiple

    Multiple inheritance: The capability of a class or interface to expand more than one interface or class. In Java, multiple inheritance is only accessible in the circumstances which are shown below: An interf

  • Q : Reference variables Reference variable

    Q : Define Short-circuit operator

    Short-circuit operator: It is an operator in which only as a lot of operands are computed as are required to determine the final outcome of the operation. The logical-and (&&) and logical-or (||) operators are most general illustration, though

  • Q : Use of new operator What is the use of

    What is the use of new operator?

©TutorsGlobe All rights reserved 2022-2023.