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 place an order similar to this with us. You are assured of an authentic custom paper delivered within the given deadline besides our 24/7 customer support all through.
Latest completed orders:
# | topic title | discipline | academic level | pages | delivered |
---|---|---|---|---|---|
6
|
Writer's choice
|
Business
|
University
|
2
|
1 hour 32 min
|
7
|
Wise Approach to
|
Philosophy
|
College
|
2
|
2 hours 19 min
|
8
|
1980's and 1990
|
History
|
College
|
3
|
2 hours 20 min
|
9
|
pick the best topic
|
Finance
|
School
|
2
|
2 hours 27 min
|
10
|
finance for leisure
|
Finance
|
University
|
12
|
2 hours 36 min
|