Question: This lab test, you will be implementing two Java classes. A UML representation of the classes is given below, with description of the implementation details.
This lab test, you will be implementing two Java classes. A UML representation of the classes is given below, with description of the implementation details. A class called Bal1 is as shown in the class Ball x double -yi double -radius: int -xDelta: double lta: double idouble, radius:int, s int, direction: int) tgetx):double +setx(double)i void tgetY) double +aetY (double) void tgetRadiua(): double setRadius(int) void +getXDelta()i double +getYDelta(): double +setYDelta(double)i void move () : void reflecthorizontal() vold treflectVertical void +toString) String The Ball class contains the following private instance variables: .x, y and radius, which represent the balls center (x. y)co-ordinates and the radius, respectively xDeltaandyDelta, which represent the displacement (movement) per step, in the x and y direction respectively The all class contains the following public methods: .A constructor which accepts x, y. radius, speed, and direction as arguments. For user friendliness, user specifies speed (in pixels per step) and direction (in degrees in the range of(-180, 180)Then direction is converted to radians. For the internal operations, the speed and direction are to be converted to (xDelta, yDelta) within the constructor. direction-radians (direction) xDelta- speed cos (direction) yDeltaspeedsin(direction) NOTE: Use Math class for radians, cos, and sin .Getter and setter for all the instance variables A method move xDelta yyDelta which move the ball by one step
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
