Overloaded Constructors
- Add a pair of constructors to the Height class that implementthe initializations provided by the two setHeight operations inFigure 7.11. Minimize the total number of statements by having theone parameter constructor call the one-parameter setHeight methodand having the two-parameter constructor call the two-parametersetHeight method.
- Provide a complete rewritten main method for the HeightDriverclass such that the new method uses one of the new constructorsfrom part a) to generate this output:
6.0 ft
/***********************************************************
* Height.java
* Dean & Dean
*
* This class stores and prints height values.
***********************************************************/
class Height
{
double height; // a person's height
String units; // like cm for centimeters
//********************************************************
public void setHeight(double height)
{
   this.height = height;
   this.units = \"cm\";
}
//********************************************************
public void setHeight(double height, String units)
{
   this.height = height;
   this.units = units;
  }
//********************************************************
public void print()
{
   System.out.println(this.height + \" \" +this.units);
}
} // end class Height
/*******************************************************************
* HeightDriver.java
* Dean & Dean
*
* This class is a demonstration driver for the Height class.
*******************************************************************/
public class HeightDriver
{
public static void main(String[] args)
{
   Height myHeight = new Height();
   myHeight.setHeight(72.0, \"in\");
   myHeight.print();
   myHeight.setHeight(180.0);
   myHeight.print();
} // end main
} // end class HeightDriver