Class Percent

    • Constructor Detail

      • Percent

        public Percent​(double n)
                throws IllegalArgumentException
        Allocates a Percent object representing the n argument
        Parameters:
        n - the value of the Percent
        Throws:
        IllegalArgumentException - if the given argument is not a valid Percent
    • Method Detail

      • toString

        public String toString()
        Returns a String Object representing this Percent's value
        Overrides:
        toString in class Object
        Returns:
        return a string representation of the value of this Percent object
      • valueOf

        public static Percent valueOf​(String stringValue)
                               throws IllegalArgumentException
        Returns a Percent instance representing the specified String value
        Parameters:
        stringValue - a String value
        Returns:
        return a Percent instance representing stringValue
        Throws:
        IllegalArgumentException - if the given argument is not a valid Percent
      • doubleValue

        public double doubleValue()
        Returns the value of this Percent object as a double primitive
        Returns:
        the primitive double value of this Percent object.
      • isValid

        public static boolean isValid​(Double doubleValue)
        check if the specified Double instance is a valid percent data type
        Parameters:
        doubleValue - the value to be tested
        Returns:
        true if the value of argument is valid for percent data type false otherwise
      • isValid

        public static boolean isValid​(String stringValue)
        check if the specified String instance is a valid percent data type
        Parameters:
        stringValue - the value to be tested
        Returns:
        true if the value of argument is valid for percent data type false otherwise