如果您使用浮点数,您可能需要重新考虑使用int
数据类型。
首先,这将引起各种悲伤:
int cashDepositOverLimitFee = 2.5;
你最好double
什么都用。
在此处查找未知变量方面,这是特定于您的业务规则的内容,此处未显示。
我冒昧地猜测这个price/$1000
数字与您的变量密切相关,cashDepositOverLimitFee
例如每多出 1000 美元就是 2.50 美元。
这将使等式:
inputCash - cashDepsitFromPlan
cashDepositOverLimit = ------------------------------ * cashDepositOverLimitFee
1000
which makes sense. The first term on the right hand side is the number of excess $1000 lots you've deposited over and above the plan. You would multiply that by a fee rate (like $2.50 or 2.5%) to get the actual fee.
However, as stated, we can't tell whether it's $2.50 or 2.5% based on what we've seen. You'll have to go back to the business to be certain.