Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

WEB Develop

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

This assessment contains materials that may be subject to copyright and other intellectual property rights.

Modification, distribution or reposting of this document is strictly prohibited. Learners found reposting this document or
its solution anywhere will be subject to the college’s Copyright and Academic Integrity policies.

Assignment 1

In this assignment, you will create a standalone Javascript program that executes using NodeJS.

When creating your solution, you must use the coding practices and conventions demonstrated in class. A
solution that does not reflect what was taught in class will not be accepted (0 grade) and/or be subject to
an academic integrity review.

Submission Requirements:

❏ Create a zip file containing your entire project folder. Name your name A1Firstname.zip, where you
replace Firstname with your firstname.

❏ A screen recording as described in the instructions. If your screen recording is too large for the
submission dropbox, then you should upload the screen recording to Microsoft OneDrive and share
the link in the submission comments. Ensure you update the link sharing settings so that it is
accessible by anyone in the college with the link.

Instructions

1. Create a NodeJS project

2. In the project, add a file named app.js

3. In the app.js file:

● Create an arrow function that accepts an array of movie objects. Each movie object has a movie
name (string), release year (number), and star rating (number). For example

Name: Spiderman Across the Spiderverse


Year Released: 2023
Star Rating: 4.5

The function must search the array for movies with a star rating greater than or equal to 3.0 (>=)
● If movies are found, then the function should return an array containing the matching
movie objects.
● If no movies are found, then the function should return an empty array.

NOTE: You must use a C-style for loop OR the for of construct. Using .forEach() is not permitted.

● Outside your function, define an array containing five (5) movie objects.

● Call the function. You should pass in the array of movies to the function via the function’s
parameter.

● Given the results from the function, write the code to do the following:
○ If results found, then output the name and star rating of the matching movies to the
console
○ If no results found, then output an error message to the console.

Page 1 of 2
This assessment contains materials that may be subject to copyright and other intellectual property rights.
Modification, distribution or reposting of this document is strictly prohibited. Learners found reposting this document or
its solution anywhere will be subject to the college’s Copyright and Academic Integrity policies.

NOTE: Although you are only required to test the application with an array of 5 movie objects, your code
should be written in a way that accommodates an array of any size. For example, if I manually change your
array to have 10 movie objects, your logic should still work.

4. When you are satisfied with the results, create a screen recording demonstrating your application. You
must show:

● What is the program output when you have movies that meet the search criteria?
● What is the program output when none of your movies meets the search criteria? (to test this, you
can manually change the search criteria to something that your data set does not contain - see
example output below)

Ensure the following items are visible in your screen recording:

a. Visual Studio Code project open to your app.js


b. The terminal window where you are entering commands to run the program
c. The output from the program in the console

Example output:

Assume your list of movies contain these values:

Name Year Rating

Spiderman Across the Universe 2023 4.5

A Thousand Words 2012 3.1

Sly 2023 5

The Whale 2022 4.98

Crossover 2006 2.22

The program should output something like this

Name: Spiderman Across the Universe, Star Rating: 4.5


Name: Sly, Star Rating: 5
Name: The Whale, Star Rating: 4.98

If the search criteria is manually changed search for movies with a star rating < 2.0, then the output is:

Sorry, no movies found.

END OF ASSESSMENT

Page 2 of 2

You might also like