Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class Project1 { public static void main(String[] args) { System.out.println(Project 1 : Points Tester ); Point a = new Point(3.0, 1.0); Point b =

image text in transcribed

public class Project1 {

public static void main(String[] args)

{

System.out.println("Project 1 : Points Tester ");

Point a = new Point(3.0, 1.0);

Point b = new Point(6.0, 5.0);

System.out.println("Point 1: " + a);

System.out.println("Point 2: " + b);

System.out.println(" Distance: " + a.distance(b));

double rotation = Math.PI / 2.0;

a.rotate(rotation);

System.out.println(" Rotated a " + rotation + ": " + a);

b.shiftX(4);

b.shiftY(-2);

System.out.println("Shifted b " + ": " + b);

}

}

Programming Project - Class Design 1) 2) Review Java programming (first 7 chapters of Java Foundations) 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: setX(x), setY(y), setPoint(x,y) set the coordinates of the point shiftX (n) , shif tYCn) shift a point by a given amount along one of the axes distance (p2) finds the distance to point p2 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(9) any other methods you believe to be necessary 3) Write a toString method for your Point class that displays the coordinates of the point as an ordered pair, eg (3,2) 4) Create a driver class that demonstrates that your methods produce the correct output. Think carefully about your design and use good object oriented principles in your implementation. Submission requirements: Include your name as a comment at the top of each source code file Make good use of whitespace/comments to make your implementation clear. . In a well-formatted doc, .pdf, or .txt file, briefly describe your implementation, give sample output, and include your entire point class Zip your code, preferably the entire Eclipse project. Do not use .rar. Include your first and last name in the .zip filename Upload your implementation/output document & zipped project separately to Canvas . * Turn in a hard copy of your implementation document Be prepared to demo your project in class following the due date

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_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions