Finally achieved encapsulation(privacy).

Changed Dollar.amount access modifier from public to  private.