Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago

Question

List behaviors to improve effective leadership in meetings

Answered: 1 week ago