nguyenthinhh91
07-04-2010, 02:56 PM
question 1: Dafine Crite class, having 2 fields: pi and r with double type, pi has value 3.14, r has value 25
a) declare calArea() method has return datatype is double to calculate area (area = r*r*pi)
b) declare main method, create a new instance of circle. Show the area
question 2:
define elip class which extends Circle, elip has two fields a,b with double type.
a) declare a constructor methodto initializevaluefor a,b
b) overriding calArea() method from super class to calculate area for Elip (area = pi=*a*b)
c) declare main method, create new instance of Elip in main. Display the area
a) declare calArea() method has return datatype is double to calculate area (area = r*r*pi)
b) declare main method, create a new instance of circle. Show the area
question 2:
define elip class which extends Circle, elip has two fields a,b with double type.
a) declare a constructor methodto initializevaluefor a,b
b) overriding calArea() method from super class to calculate area for Elip (area = pi=*a*b)
c) declare main method, create new instance of Elip in main. Display the area