Skip to content

Instantly share code, notes, and snippets.

@spierala
Created August 12, 2014 13:22
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 spierala/6e43f38feecb5c9c017c to your computer and use it in GitHub Desktop.
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]
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