Created
August 12, 2014 13:22
-
-
Save spierala/6e43f38feecb5c9c017c to your computer and use it in GitHub Desktop.
node.js vat calculator usable in the console like this: node vat.js [netto]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
VatCalculator = function (netto) { | |
this.netto = netto; | |
}; | |
VatCalculator.prototype.calculate = function(parts) { | |
var vat = 0.19 * this.netto; | |
var brutto = Number(this.netto) + Number(vat); | |
util.puts("vat: " + vat); | |
util.puts("brutto: " + brutto); | |
} | |
var vatCalculator = new VatCalculator(process.argv[2]); | |
vatCalculator.calculate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment