Question: Program is java based and uses greenfoot. The only thing that needs to be filled in is the skeleton code below the instruction. (There is
Writing methods for the Button class 1. Write the body of the act() method of the Button class. The (act method changes the location of the Button object approximately 2% of the time: that is, on approximately 2 out of every 100 "act" cycles of the scenario, the Button object calls its changeLocation method. List of methods to use: o Greenfoot.getRandomNumber changeLocation 2. Write the body of the changeLocation) method of the Button class. The changeLocation method sets the location of the Button object to a new (x, y) coordinate selected at random. The coordinate must be selected from the range 100 to 500 inclusive, and the y coordinate must be selected from the range 100 to 300 inclusive. List of methods to use: o Greenfoot.getRandomNumber o setLocation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
