Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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/2023 7: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()

Goals and Objectives: 1. Write a Java program which can be used as an abstract data type (ADT) 2. Correctly use access modifiers in conjunction with instance variables and instance methods 3. Write overloaded constructors 4. Write programs containing no-argument constructors and constructors with arguments 5. Create get and set methods belonging to abstract data types 6. Demonstrate an understanding of the toString method by using it in a Java program 7. Create objects of your ADT and use these objects to execute the ADT's methods Instructions: Refer to the Time1 class provided in Figure 8.1 in your Deitel book to complete the exercise. 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 x coordinate =15". DO NOT print from within the toString method

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

5. Describe how contexts affect listening

Answered: 1 week ago