Home Answers Viewqa Java-Beginners inheritance....please help me friends...!!!... this is important project that i have to do it..

 
 


Rajeswary Govindasamy
inheritance....please help me friends...!!!... this is important project that i have to do it..
0 Answer(s)      6 months and 4 days ago
Posted in : Java Beginners

Point
.................
#x : int
#y : int
+ Point()
+ Point(xCoordinate:int, YCoordinate:int)
+ getX() : int
+ getY() : int
(circle extends the the point)

Circle
..........
- radius : double
+ Circle()
+ Circle(x:int, y:int, radius:double)
+ setRadius(newRadius:double) : void
+ getRadius() : double
+ displayArea() : double

a) Write a class named Circle that extends Point class. Refer a figure below to identify the attributes and methods for Circle class. In the Circle default constructor, value 0 is assigned to radius. The parameterized constructor used to construct with specified radius, X and Y.
In the Point class, its default constructor will assign X and Y to value 0 whereas the parameterized constructor will assign value of xCoordinate to X and YCoordinate to Y. The getX() method and getY() method used to get the value of X and Y respectively, and return to a caller.

b) Write a test program that
- Create one Circle object known as objectCircle with radius is 2.7, x = 120 and y is 89.
- Display the y, y , radius and area of that objectCircle.
- Call function setRadius() by assigning 3.0 to new value of radius for objectCircle.
- Display the latest radius and area for objectCircle.
View Answers









Related Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.