In this homework assignment, you will modify the Investment class that you wrote in Lab 4. The changes will help insure that investment objects are always in a valid state.
Rewrite the initialization constructor so that it tests the values of its parameters. The present value, the nominal rate, and the time in years should all be positive values. Test each one individually and if the corresponding value is negative or zero, use the default value instead (the value assigned in the default constructor). The periods per year should be 1, 2, 4, or 12. If the parameter is some other value, use the default value (from the default constructor).
Don't forget to modify the document comments to reflect these changes.
Modify each of the setter methods. In each case, test the new value to determine whether it is appropriate (as defined in the preceding section). If the value is appropriate, the setter should change the value as it did before. However, if the new value is inappropriate, then the setter should not do anything. That is, a change will be made to the state of the investment only if the new value is appropriate.
Don't forget to modify the documentation comments in the setter methods to reflect these changes.
Be sure to correct any mistakes you made in your Lab 4 project. Submit your Investment.java file as an attachment to an email message whose subject is "Hmwk06".