代做COMP 315、Java设计编程代写
Assignment 1: Javascript
COMP 315: Cloud Computing for E-Commerce
February 2025
1 Introduction
A common task when backend programming is data cleaning, which is the process of taking an initial data set
that may contain erroneous or incomplete data, and removing or fixing those elements. In this assignment, you
will be tested on your knowledge of JavaScript by implementing a set of functions that perform data cleaning
operations on a dataset.
2 Objectives
By the end of this assignment, you will:
• Gain proficiency in using JavaScript for data manipulation.
• Be able to implement various data cleaning procedures, and understand the significance of them.
• Have developed problem-solving skills through practical application.
3 Initial setup
On the canvas page for this assignment, there is a template file called Data P rocessing.js. Upload this template
file to Codegrade. Note that the function signatures and module export statements have been prepared for you.
Codegrade hosts a series of unit tests that will auto mark your code, and will present you with your final mark.
This allows for immediate feedback and removes any potential bias in marking. You have an unlimited number
of submissions to Codegrade. For this assignment you cannot import any additional libraries, as only the File
System (FS) library is allowed. The data you will be cleaning can be seen in Table 1.
Data name Note
id This is a unique integer identifier for each item.
name Each product has a name, which for this data set will just be the type of product followed
by a unique identifier integer.
price This is a real value representing the cost of the product.
category Each product has a general category such as Clothing or Electronics, and is saved as a
string.
type Each product’s type is a string that represents what sort of item it is.
quantity This is an integer value that shows how many of this item is currently in stock.
rating This is a real value that is a multiple of 0.5, starting from 0 and being capped at 5. This
value represents the number of stars users rate the item.
image link This is the link to the product in the database, and is saved in the format of “[cate gory]/[type]/[name].jpg”. Name is all in lowercase with the spaces replaced with under scores.
Table 1: The attributes that are stored for each product
1
Data name Note
category Each product has a general category such as Clothing or Electronics, and is saved as a
string.
type Each product’s type is a string that represents what sort of item it is.
min price This number represents the minimum price for this type of product.
max price This number represents the maximum price for this type of product.
Table 2: The attributes that are stored for pricing each type of product
4 Data cleaning
Add the following functionality to each of the functions. Do not modify the function signature or return
statement. The f ile name variable is the string that corresponds to a JSON file name without the ‘.json’
extension. For example if the file is called test.json then f ile name would have test stored. The entries
variable is an array of JSON objects corresponding to products. Each JSON object has the attributes listed in
Table 1. The products prices variable is an array of JSON objects corresponding to the minimum and maximum
price for each type of product. Each JSON object has the attributes listed in Table 2.
4.1 load JSON
This function should take the f ile name variable and load the corresponding JSON file. Note that the ‘.json’
file extension should be added. If the file cannot be found then an exception should be thrown that says
”‘[file name].json’ cannot be found”, where [file name] is replaced with the actual file name. The input text
should be converted to an array of JSON objects. If this process cannot be done, then it should throw the error
”‘[file name].json’ is not a valid JSON file” where again [file name] is replaced with the actual file name.
4.2 clean name
This function should iterate through each of the products, and replace null name values with the correct name.
If the name value is ‘null’ then the image link variable should be checked. If image link is not ‘null’ then
the name should be extracted from that. It should replace the underscores with spaces, and each word should
be capitalised. If image link is ‘null’ then the name should be taken from the ‘type’ variable. Each name is
unique, and is the type value with a unique integer identifier appended to it. This identifier corresponds to the
number of that type of product that have occurred up to that point. For example if the product type is ”Belt”,
and it is the third ”Belt” in the product list then it’s name should be ”Belt 3”.
4.3 clean price
This function takes in the entries variable, as well as the product prices variable. The price values should
always be non-negative number, and should first be changed to positive. The corresponding min price and
max price for this type of product should be found from product prices. If the price for the product is less
than the min price value for that type of product, then it should be set as the min price value. For example
if the price of Shoe4 is 1, and the min price value for Shoe is 3, then the price for Shoe4 should be set to 3. If
the price for the product is more than the max price value for that type of product, then it should be set as
the max price value.
4.4 clean category
This function should check if the category is ‘null’, then it should use the type value to fill in the missing data.
It should find other entries with the same type value, and then use this to fill in the corresponding category
value.
4.5 clean type
This function should check if the type is ‘null’, then it should check the name value. If the name is not ‘null’
then it should remove the unique number and use that value. If the name is ‘null’ then it should derive the
name from the image link.
2
4.6 clean quantity
The quantity of a product must be a non-negative value, so if the value is negative then it should be set to
positive. If the value is not an integer, then it should be rounded to the nearest integer using standard ‘rounding
half up’ rounding.
4.7 clean rating
If the rating for a product is set to ‘null’, then it should be set to 0. The rating of a product is given as a star
value between 0 and 5 stars. It is possible to give a product half a star, therefore the possible values are: 0, 0.5,
1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5. If a value does not correspond to one of these, then it should be rounded to the
nearest possible value.
4.8 clean image link
This function populates ‘null’ image link values using the other variables for the JSON object. This should be
in the format of “[category]/[type]/[name].jpg”. The category and type values are used as they are, however
the name value should all be in lowercase with spaces replaced with underscores. The ‘.jpg’ text should be
appended to the end.
5 Marking
The marking will be carried out automatically using the CodeGrade marking platform. A series of unit tests
will be ran, and the mark will correspond with how many of those unit tests were successfully executed. Your
work will be submitted to an automatic plagiarism/collusion detection system, and those exceeding a threshold
will be reported to the Academic Integrity Officer for investigation regarding adhesion to the university’s policy
.6 Deadline
The deadline is 23:59 GMT Thursday the 20th of March 2025. Late submissions will have the
typical 5% penalty applied for each day late, up to 5 days.

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图