Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Rajeswary Govindasamy
inheritance....please help me friends...!!!... this is important project that i have to do it..
0 Answer(s)      2 years 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.

Advertisement
View Answers

Related Tutorials/Questions & Answers:
 

 

 

DMCA.com