Skip to content

Instantly share code, notes, and snippets.

@hachibeeDI
Created February 16, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hachibeeDI/2540e7d00ffd2691ac5e to your computer and use it in GitHub Desktop.
Save hachibeeDI/2540e7d00ffd2691ac5e to your computer and use it in GitHub Desktop.
リボの手数料の雑な算出
ammount = process.argv[2]
each = process.argv[3]
interest = if process.argv[4] == undefined then 15.0 else process.argv[4]
interest_each_month = (interest / 12) / 100
# console.log interest_each_month
# console.log ammount * interest_each_month
i = 0
ammount = ammount - each
ammount_of_commission = 0
console.log '----- ', i, ' ------'
console.log "ammo: ", ammount
console.log "commi: ", ammount_of_commission
while ammount >= 0
i = i + 1
commission = Math.round(ammount * interest_each_month)
ammount_of_commission += commission
ammount = ammount + commission
console.log '----- ', i, ' ------'
console.log "ammo: ", ammount
console.log "commi: ", commission
if ammount <= each
console.log ammount
break
ammount = ammount - each
console.log "ammo of commi: ", ammount_of_commission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment