title: Limiting the inputs to a constructor while keeping constructor code minimal
body: <p>Well, I was told that I have to create a money class that accepts currency and value. The value should be stored as 2 integers, one representing the dollar value, then the other one in cents. </p>
  
  <p>*<strong><em>It should accept the decimal value precise to two (2) decimal places. *</em></strong></p>
  
  <p>So I suppose I have to limit the cents value so that it should accept only 1 to 2 digit integers. Now, my problem is, my mentor told me that it is bad practice to do other stuff inside the constructor. How am I supposed to limit the input then if I'm not allowed to do anything with the constructor other than:</p>
  
  <pre><code>public class Money {
      Currency currency;
      int dollar;
      int cents;
  
      public Money(Currency currency, int dollar, int cents) {
          super();
          this.currency = currency;
          this.dollar = dollar;
          this.cents = cents;
      }
      ..... other code.....
  }
  </code></pre>
  
  <p>Any other ideas on how I am supposed to implement what was instructed of me? Why is it bad practice and is there a way to define constraints without being guilty of this bad practice???</p>