completed the setAmount function.