Question: 1 . Write a Point class. The Point class should be written as an abstract data type. 2 . Include the following instance variables: a

1. Write a Point class. The Point class should be written as an abstract data type.
2. Include the following instance variables:
a. an integer representing the x coordinate
b. an integer representing the y coordinate
c. The instance variables in your program should only be directly accessible inside of the Point
class.
3. Have 2 constructors for the Point class.
a. a no-arguments constructor, set both of the instance variables to 0(zero).
b. a constructor having two arguments, one for each of the two instance variables, set the instance
variables to those argument values.
4. Include get and set methods for each of the two instance variables identified in step 2.
5. Include a toString method in your Point class. The toString method should be accessible to any program
and should return the values of the two instance variables. Values must be labeled; e.g.The xcoordinate =15. DO NOT print from within the toString method.
6. Write a client program (also known as a driver, tester). See the Time1Test program in Figure 8.2 of
your Deitel book. Use this program as a model to write your program. Your program will have the
same intent but will follow the procedure as outlined below. Name your program PointTest.
7. In the PointTest class,
a. Print your name, Lab number, and date as the first three lines of output. Hard-code the date...do
not use the system date.
b. Create an object of type Point using the no-arguments constructor. Call this point1
c. Create a second object of type Point using the two-argument constructor. Call this point2. Use
the values of x =11, y =24
d. Display point 1 instance variables after a call to point1.toString()
e. Display point 2 instance variables after a call to point2.toString()
f. Change the x value of point1 to 35 using the set method for the x value of point1
g. Display point 1 instance variables after a call to point1.toString()
Lab 1- Advanced Java
The Point Lab - Abstract Data Types and Objects
Rev. 1/18/20237:58 PM
h. Display point 2 instance variables after a call to point2.toString()
i. Change the y value of point2 to 13 using the set method for the y value of point2
j. Display point 1 instance variables after a call to point1.toString()
k. Display point 2 instance variables after a call to point2.toString()
8. Here is an example of the output. Your version may vary, though your values should match mine.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!