Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing this program in java, it includes creating 2 classes. Please help, thank you! Requirements for Point class The point class represents

I need help writing this program in java, it includes creating 2 classes. Please help, thank you! image text in transcribed
Requirements for Point class The point class represents a point on the screen. On the screen, the top-left corner is considered point (0,0). When moving down, the y- coordinate increases, to move right, the x-coordinate increases. * Instance variables: xcoord and ycoord, both of type int. Constructors: a copy constructor and a constructor that takes initial values for the x-and y-coordinates. Methods o Getter and setter methods for both instance variables. x- and y-coordinates must be non-negative o moveUp, moveDown, moveRight and moveLeft which al take an argument of type int which represents how far to move o distance which takes another Point as an arqument and returns the euclidean distance between itself and the point provided as an argument. The value returned should be of type double. o equals which takes another Point as an argument and returns true if it has the same x- and y-coordinate as the Point provided as an argument. Requirements for Line class e Instance variables: start and end, both of type Point. Both instance variables must be completely encapsulated. Make sure to prevent all privacy leaks * Constructors: one constructor that takes a start and end point as an argument. Methods o getter and setter methods for both instance variables. o length which takes no argument and returns the length of the line as a double. (The distance between the start and end point.)

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: 3

blur-text-image

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

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions