Write a class Height which has the instance variables feet (int) and inches (int)
(1) Write two constructors (one is default constructor and another should take two arguments of type int)
(2) Write two set methods ..(a) one set will have one argument (inches) of type int and set it to feet and inches ..using conversion rule
(b) Another set method will take an argument of type Height and set the instance variables (feet, inches) to the corresponding fields of the argument
(3) And two equal methods ..(a) one takes one argumnet of type Height and check the corresponding fields and returns a boolean value
(b) another equal takes one argument of type int (in inches) and returns a boolean value
Write a main method and test the methods you have written...
Note that 12 inches = 1 foot
Tuesday, October 19, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment