From essays to dissertations, we have experts for all of your assignments!

dot
  • 1.provide your instructions
  • 2.choose an expert in your field
  • 3.track the order progress

Javascript

This week’s exercise is to design a program for node.js that calculates paychecks for a small business. The program must read the two files “wages.csv” and “hours.csv” which are 2 column CSV files, an employee name and a number. In the case of “wages.csv” the number represents the hourly wage. In the case of “hours.csv” the number represents the number of hours worked in the last pay period. Some names in “wages.csv” may not be present in “hours.csv” (in case the employee has not worked). The program must produce the file “report.txt” with a line for each employee indicating the amount of the paycheck of this employee. Here are examples of “wages.csv”, “hours.csv” and “rapport.txt” files:

“wages.csv” file

Jean Dubuc, 25
Anne Gadbois, 20
Julie Tremblay, 40
Paul Tremblay, 20
Marie Valois, 15

“hours.csv” file

Jean Dubuc, 70
Julie Tremblay, 60
Marie Valois, 80

File “rapport.txt”

Jean Dubuc: pay $ 1,750
Anne Gadbois: pay $ 0
Julie Tremblay: pay $ 2,400
Paul Tremblay: pay $ 0
Marie Valois: pay $ 1,200
Your program must use the read CSV function seen in class. Note that the program should start with a comment that gives your name, followed by the following definitions for the readFile and writeFile functions, needed in the node.js environment:

var fs = require (“fs”);
var assert = require (“assert”);

var readFile = function (path) {
    return fs.readFileSync (path) .toString ();
};
var writeFile = function (path, text) {
    fs.writeFileSync (path, text);
};
Write a testCheques unit test function that tests your functions. As usual, in addition to doing the requested processing correctly, your code must be correctly indented, it must contain explanatory comments and significant identifiers.

I suggest you use emacs to develop your code.

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes