1. Homepage
  2. Programming
  3. [2022] COMP1531 Software Engineering Fundamentals - Lab03 Holidays

[2022] COMP1531 Software Engineering Fundamentals - Lab03 Holidays

Engage in a Conversation
UNSWCOMP1531Software Engineering FundamentalsLab03 HolidaysnpmJavascriptProgramming Help

Lab03 Holidays CourseNana.COM

Background CourseNana.COM

Rationale CourseNana.COM

Everybody loves holidays, and your client is no exception ! CourseNana.COM

You have been approached with a problem - your client wishes to know which day of the week Christmas, Easter and Valentine's day would fall on in a particular year, regardless of whether it is in the past, present or future. CourseNana.COM

Being a clever and efficient software engineer, you knew that writing a date-time library yourself could only bring forth pain and suffering. Fortunately, the wheels do not need to be re-invented for you have recently acquired infinite wisdom through the Node Package Manager (npm). CourseNana.COM

Getting Started CourseNana.COM

Please make sure you have completed lab03_password prior.
Copy the SSH clone link from Gitlab and clone this repository on either VLAB or your local machine.
In your terminal, change your directory (using the
cd command) into the newly cloned lab. To check if you have done this correctly, type ls in this new directory to see if you can see the relevant files (including holidays.js). CourseNana.COM

Package Installation CourseNana.COM

1. Open package.json and look under the key "devDependencies" . We have added these development packages from lab03_password for you. CourseNana.COM

2. Quickly install the packages with the command: CourseNana.COM

$ npm install # shortcut: npm i CourseNana.COM

3. Under "scripts" , make the following changes: CourseNana.COM

1   "scripts": { CourseNana.COM

2       "test": "jest", CourseNana.COM

3   } CourseNana.COM

For this exercise, we will be using the following libraries: CourseNana.COM

·       date-fns for parsing dates CourseNana.COM

·       date-fns-holiday-us for useful holiday functions CourseNana.COM

·       prompt-sync for reading user input from the command line CourseNana.COM

1.      You can install all three packages in one command with: CourseNana.COM

1      $ npm i date-fns date-fns-holiday-us prompt-sync CourseNana.COM

2.      Open package.json and ensure that these packages appear under the key "dependencies" , e.g CourseNana.COM

CourseNana.COM

1      // Note: Your version number may differ CourseNana.COM

2      "dependencies": {
"date-fns": "^2.28.0", "date-fns-holiday-us": "^0.2.1", "prompt-sync": "^4.2.0" CourseNana.COM

3      } CourseNana.COM

  CourseNana.COM

3.      Use git status, add, commit and push your package.json and package-lock.json. CourseNana.COM

Task CourseNana.COM

Writing Tests CourseNana.COM

In holidays.test.js, complete a test suite for holidaysInRange . You should aim to cover different cases for the function. You do not need to write tests for the main function.
You may find the following resource useful:
CourseNana.COM

https://www.calendar-365.com/holidays/1970.html CourseNana.COM

Try changing 1970 to a different year in the link above CourseNana.COM

Implementation CourseNana.COM

In holidays.js, implement the function holidaysInRange according to its documentation.
This exercise is difficult to complete without using the libraries provided. You may want to spend some time reading the documentation for
date-fns CourseNana.COM

and date-fns-holiday-us before starting. CourseNana.COM

Ensure that your code passes all of the written tests before submitting it. CourseNana.COM

Main - Reading Inputs from Commandline CourseNana.COM

In the main function, use prompt-sync to read the start and end year from the user and print the output of holidaysInRange to stdout . This function is imported and called in main.js. CourseNana.COM

Note that prompt-sync reads inputs as strings, so you will need to use convert them to integers using parseInt() ! CourseNana.COM

Here are a few examples (it is fine if your output differs by white space): CourseNana.COM

1   $ node main.js
Enter start: 1970 # NOTE: user enters 1970 CourseNana.COM

2   Enter end: 1972 # NOTE: user enters 1972 CourseNana.COM

3      [ CourseNana.COM

4       { CourseNana.COM

5           valentinesDay: 'Saturday, 14.02.1970', CourseNana.COM

6           easter: 'Sunday, 29.03.1970', CourseNana.COM

7              christmas: 'Friday, 25.12.1970' CourseNana.COM

8       }, { CourseNana.COM

9           valentinesDay: 'Sunday, 14.02.1971', CourseNana.COM

10         easter: 'Sunday, 11.04.1971', CourseNana.COM

11         christmas: 'Saturday, 25.12.1971' CourseNana.COM

12     }, { CourseNana.COM

13         valentinesDay: 'Monday, 14.02.1972', CourseNana.COM

14         easter: 'Sunday, 02.04.1972', CourseNana.COM

15           christmas: 'Monday, 25.12.1972' CourseNana.COM

16   CourseNana.COM

17       } CourseNana.COM

18   ] CourseNana.COM

CourseNana.COM

Start is less than 325: CourseNana.COM

1   $ node main.js CourseNana.COM

2   Enter start: 324 CourseNana.COM

3   Enter end: 325 CourseNana.COM

4      [] CourseNana.COM

Tips CourseNana.COM

1. Avoid manually parsing the date string format yourself - use the provided libraries!
2. You may not use any libraries other than the ones listed unless mentioned otherwise by our course staff.
CourseNana.COM

Submission CourseNana.COM

Use git to add , commit , and push your changes on your master branch.
Check that your code has been uploaded to your Gitlab repository on this website (you may need to refresh the page).
CourseNana.COM

If you have pushed your latest changes to master on Gitlab no further action is required! At the due date and time, we automatically collect your work from what's on your master branch on Gitlab. CourseNana.COM

Additional Information CourseNana.COM

Sample package.json CourseNana.COM

Click to view our sample package.json CourseNana.COM

  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
UNSW代写,COMP1531代写,Software Engineering Fundamentals代写,Lab03 Holidays代写,npm代写,Javascript代写,Programming Help代写,UNSW代编,COMP1531代编,Software Engineering Fundamentals代编,Lab03 Holidays代编,npm代编,Javascript代编,Programming Help代编,UNSW代考,COMP1531代考,Software Engineering Fundamentals代考,Lab03 Holidays代考,npm代考,Javascript代考,Programming Help代考,UNSWhelp,COMP1531help,Software Engineering Fundamentalshelp,Lab03 Holidayshelp,npmhelp,Javascripthelp,Programming Helphelp,UNSW作业代写,COMP1531作业代写,Software Engineering Fundamentals作业代写,Lab03 Holidays作业代写,npm作业代写,Javascript作业代写,Programming Help作业代写,UNSW编程代写,COMP1531编程代写,Software Engineering Fundamentals编程代写,Lab03 Holidays编程代写,npm编程代写,Javascript编程代写,Programming Help编程代写,UNSWprogramming help,COMP1531programming help,Software Engineering Fundamentalsprogramming help,Lab03 Holidaysprogramming help,npmprogramming help,Javascriptprogramming help,Programming Helpprogramming help,UNSWassignment help,COMP1531assignment help,Software Engineering Fundamentalsassignment help,Lab03 Holidaysassignment help,npmassignment help,Javascriptassignment help,Programming Helpassignment help,UNSWsolution,COMP1531solution,Software Engineering Fundamentalssolution,Lab03 Holidayssolution,npmsolution,Javascriptsolution,Programming Helpsolution,