Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.Invoke the move()method within the act()method of Orband compile.Instantiate a

ID: 440595 • Letter: 1

Question

1.Invoke the move()method within the act()method of Orband compile.Instantiate an Orb, assigning it initial xSpeedand ySpeedvalues. When you run the program, the Orbshould move until it reaches a corner.Explain what happens and why this breaks the realism of the simulation. 2-Cause the Orb to make a noise if it bounces off of a wall. 3. Within the OrbWorldconstructor, use a loop to place at least fiveOrbs in the world whenever you run the program. Use conditions to ensure none of theOrbgraphics will be cut off by the edge of the world. Assign each of theOrbs a random velocity.

Explanation / Answer

public void act() { move(); } public void move() { exactX = exactX + vel.getXSpeed(); exactY = exactY + vel.getYSpeed(); super.setLocation( (int) exactX, (int) exactY); } /** * get the x location */ public int getExactX() { return exactX; } /** * get the y location */ public int getExactY() { return exactY; } /** * get x speed */ public void getXSpeed() { xSpeed = -xSpeed; } /** * get y speed */ public void getYSpeed() { ySpeed = -ySpeed; }