src/main/java/seedu/insurancepal/commons/core/Money.java
/**
     * Returns true if the given string is a valid input for Money. Ensure that it has up to 2 decimal places.
     *
     * @param test Given String to be checked.
     * @return A boolean that is true if the given string is a valid input for Money.
     */
Returns true if the given string is a valid input for Money. Ensure that it has up to 2 decimal places.
@param test Given String to be checked.
@return A boolean that is true if the given string is a valid input for Money.
Returns true if the given string is a valid input for Money . Ensure that it has up to 2 decimal places . @param test Given String to be checked . @return A boolean that is true if the given string is a valid input for Money .
public static boolean isValidMoney(String test) {
        try {
            BigDecimal value = new BigDecimal(test);
            return Math.max(0, value.stripTrailingZeros().scale()) <= 2;
        } catch (NumberFormatException e) {
            return false;
        }
    }
public static boolean isValidMoney ( String test ) { try { BigDecimal value = new BigDecimal ( test ) ; return Math . max ( 0 , value . stripTrailingZeros ( ) . scale ( ) ) <= 2 ; } catch ( NumberFormatException e ) { return false ; } }
Returns true if the given string is a valid input for Money.
Returns true if the given string is a valid input for Money .