MyPoint Java class
Not what you're looking for?
Design a Java class named MyPoint to represent a point with x and y coordinates. This class should contain:
- Two data fields x and y that represent the coordinates.
- A no-argument constructor that creates a point (0, 0).
- A constructor that constructs a point with specified coordinates.
- Two get methods for data fields x and y, respectively.
- A method named distance that returns the distance from this point to another point of the MyPoint type.
- A method named distance that returns the distance from this point to another point with specified x and y coordinates.
Implement the class, and also write a test program that creates two points (0, 0) and (10, 30.5) and displays the distance between them.
Purchase this Solution
Solution Summary
This solution helps design a Java class named MyPoint to represent a point with x and y coordinates. It helps implement the class and write a test program that creates two points and displays the distance between them
Solution Preview
Please rename the attached 331698.java as MyPoint.java before you compile it. Please use this solution as a ...
Purchase this Solution
Free BrainMass Quizzes
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
C++ Operators
This quiz tests a student's knowledge about C++ operators.
Basic Networking Questions
This quiz consists of some basic networking questions.