Menu

(Solved) : 1 Complete Following Programming Assignment Design Implement Class Called Point Used Keep Q43991666 . . .

java
1) Complete the following programming assignment: Design & implement a class called Point that can be used to keep track of a1) Complete the following programming assignment: Design & implement a class called Point that can be used to keep track of a location in the Cartesian plane. Include (at a minimum) the following methods: • shiftX(n),shiftY(n) shift a point by a given amount along one of the axes • swap () which swaps the values of the x & y coordinates •distance () & distance (p2) finds the distance to the point p2 or the origin if no point given. • rotate (Angle) rotates the point by a specified angle around the origin. The formula for rotation is as follows: x’ = x cos(O) – y sin(O) y’ = x sin(O) + y cos(O) any other methods you believe to be necessary. 2) Write a toString () method for your Point class that displays the coordinates of the point as an ordered pair, eg (3,2) 3) Create a driver class that demonstrates that your methods produce the correct output. Show transcribed image text 1) Complete the following programming assignment: Design & implement a class called Point that can be used to keep track of a location in the Cartesian plane. Include (at a minimum) the following methods: • shiftX(n),shiftY(n) shift a point by a given amount along one of the axes • swap () which swaps the values of the x & y coordinates •distance () & distance (p2) finds the distance to the point p2 or the origin if no point given. • rotate (Angle) rotates the point by a specified angle around the origin. The formula for rotation is as follows: x’ = x cos(O) – y sin(O) y’ = x sin(O) + y cos(O) any other methods you believe to be necessary. 2) Write a toString () method for your Point class that displays the coordinates of the point as an ordered pair, eg (3,2) 3) Create a driver class that demonstrates that your methods produce the correct output.

Expert Answer


Answer to 1) Complete the following programming assignment: Design & implement a class called Point that can be used to keep track…

OR