comp 2406 assignment 1.ZIP

comp 2406 assignment 1

In this assignment you will writing two programs, words-sync.js and words-async.js. These programs will make use of synchronous and asynchronous I/O is the manner of the programs from Tutorial 1.These programs should both behave as follows:
They should take two arguments, an input text file and an output file to create. Thus you run them by typing "node words-sync.js document.txt wordlist.txt", with document.txt being the file to be read and wordlist.txt is the file to be created.
The output file should contain a list of words in the input file, one word per line, with each line terminated by a newline character ('\n'). These words should be sorted in ascending order, as ordered by the standard JavaScript Array.sort() method (with no comparison function specified). All duplicates should be removed and there should be no blank lines.
Once the output file has been created, the program should output "Finished!" to the console.
For the purposes of this program, words can be defined as anything matching the \w operator. In other words, to split the document into words you may call split() using /\W/ as the split regular expression.
You may assume that the input file exists and is readable and the output file is writable. In other words you do not need to do any error checking (although it is appreciated).
In creating this program, don't forget that you can use standard JavaScript methods such as push(), pop(), shift(), and unshift(). And of course you'll need the methods from the Node fs module.There are 10 points, allocated as follows:
3 points for producing the correct output given well-formed input.
2 points for correctly structuring the code in the synchronous version.
5 points for correctly structuring the code in the asynchronous version. In particular, "Finished!" should only be output when the program is truly finished!
Please submit your answers as a zip file called "<", where username is your MyCarletonOne username. This zip file should uncompress to a directory called "<username-comp2406-assign1" and inside this directory should be three files: "words-sync.js", "words-async.js", and a text file "comments.txt"."comments.txt" should:
list any references you used to complete the assignment (documentation web sites, for example),
list your collaborators, and
optionally, should discuss any issues or concerns you had when completing this assignment.
Powered by