test various operations on a point.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Part 1I:
Write a test program to test various operations on a point. For example, declare and
create two objects of type Point. Each created object should include values read from the
keyboard, for example object1(3, 5), object2(6,9). Display the value of each object. Test
whether the two objects are equal. If they are not equal find and display the distance
between the two objects. Create static method named distanceArray. The methods receive
two parameters. The first one is a two dimensional array of type Point which has several
rows and two columns. The second parameter is one dimensional array of type double
that contains several rows equivalent to the number of rows of the two dimensional array.
The methods calculates the distance between the two objects of each row and store it in
1
the second array. Test this method by creating two dimensional array with several rows
and two columns. Populate this array with values from the keyboard. Create an empty
one dimensional array with number of rows equal to the number of rows of the two
dimensional array. Call the method distance Array and then print the objects of the two
dimensional array and the distance between the pair of the objects of each row.
Transcribed Image Text:Part 1I: Write a test program to test various operations on a point. For example, declare and create two objects of type Point. Each created object should include values read from the keyboard, for example object1(3, 5), object2(6,9). Display the value of each object. Test whether the two objects are equal. If they are not equal find and display the distance between the two objects. Create static method named distanceArray. The methods receive two parameters. The first one is a two dimensional array of type Point which has several rows and two columns. The second parameter is one dimensional array of type double that contains several rows equivalent to the number of rows of the two dimensional array. The methods calculates the distance between the two objects of each row and store it in 1 the second array. Test this method by creating two dimensional array with several rows and two columns. Populate this array with values from the keyboard. Create an empty one dimensional array with number of rows equal to the number of rows of the two dimensional array. Call the method distance Array and then print the objects of the two dimensional array and the distance between the pair of the objects of each row.
1.
Part 1: A point in the x-y plane is represented by its x-coordinate and y-coordinate.
Design the class Point that can store and process a point in the x-y plane.
Your class should contains the following methods.
Default constructor without parameters that initializes the private data member to
the suitable values
Constructor with parameters sets the values of the instance variables to the
values of the parameter.
Accessor methods that return the values of the x-axis and y-axis.
setPoint method which set the values of x-axis and y-axis
makeCopy method that make a copy of a received object of type Point.
getCopy method that returns a copy of the current object
toString method that returns the object string
isEqual that returns true if the current object is equal to the received object of type
point
distance, which receives two objects of type Point and returns the distance
Transcribed Image Text:1. Part 1: A point in the x-y plane is represented by its x-coordinate and y-coordinate. Design the class Point that can store and process a point in the x-y plane. Your class should contains the following methods. Default constructor without parameters that initializes the private data member to the suitable values Constructor with parameters sets the values of the instance variables to the values of the parameter. Accessor methods that return the values of the x-axis and y-axis. setPoint method which set the values of x-axis and y-axis makeCopy method that make a copy of a received object of type Point. getCopy method that returns a copy of the current object toString method that returns the object string isEqual that returns true if the current object is equal to the received object of type point distance, which receives two objects of type Point and returns the distance
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY