Javascript代写 | ICTPRG414 Part 1: Practical tasks

本次Javascript代写是编写脚本来存储和维护五名运动员的信息, 并查找运动员的身高

ICTPRG414 Part 1: Practical tasks
Task 1: Write code
Write a script to store and maintain five athletes’ information. The script will allow users to store the name and height of each athlete, and to find the height of an athlete. Complete the following requirements using JavaScript:
1. Declare an array to store the five athletes’ name.
2. Declare an array to store the five athletes’ height in cm.
3. Define a function with two parameters (name and height) to store an athlete’s information into the arrays.
a. In the function, create insertion algorithms to operate on the arrays and store the information in sequential order. For example, the first and the second names entered will be stored in the first and second position of the first array.
b. The function will return either ‘array is full’ or ‘added successfully’.
4. Define a function with one parameter (position) to find an athlete by the position stored in the array and to return the details of athlete found.
a. In the function, code random access algorithms to operate on the arrays and return the athlete’s information as a string.
5. Define a function with one parameter (name) to remove an athlete’s information from the arrays.
a. In the function, create deletion algorithms to operate on the arrays and remove the athlete information found in the two arrays.
b. The function will return either ‘not found’ or ‘removed successfully’.
6. Save the script file as TaskOne.js.
7. Save copies of TaskOne.js as TaskTwo.js and TaskThree.js.
Task 2: Maintain and test code
Refactoring is required to make the code easier to maintain.
1. Modify the function in TaskTwo.js to remove an athlete by splitting the function into two smaller functions:
a. The first function must find the position of an athlete in the name array. This function has one parameter (name) to find an athlete by the name and to return the position of athlete found in the array, using a sequential access algorithm. If the information cannot be not found, return -1.
b. The second function must remove an athlete’s information from the arrays. This function has one parameter (name) and uses the preceding function to find the position of an athlete in the arrays. Once the position is found, use deletion algorithms to remove the information from both arrays. The function will return either ‘not found’ or ‘removed successfully’.
c. Save the updated TaskTwo.js script file.
2. Design and create a test plan in a word-processed document to ensure your code works correctly. Your test plan should include correct and incorrect data and actions, as well as the expected outcomes. Refer to the program specifications to ensure your code meets the requirements.
3. Follow your test plan to test your code using a suitable testing tool. Record the test results in the test plan, including the actual outcomes and screenshots or log files of the test.
Task 3: Update code
Modify the TaskThree.js script and the provided web page file TaskThree.html according to the following requirements:
1. TaskThree.html includes two HTML button elements. Update the required event attributes of the buttons so that Save and Find operations will be performed when a user clicks the relevant buttons.
2. Link the TaskThree.js file to the TaskThree web page.
3. Update the TaskThree.js file as follows:
a. Remove the two functions:
 Find an athlete by position
 Remove an athlete.
b. Define a data structure to store each athlete’s information.
c. Replace the two arrays with one array. Use the data structure to describe the information stored in the array.
d. Change the function to store an athlete’s information into the array:
 Replace the two parameters (name and height) with one parameter. Use the data structure to describe the parameter data.
 Modify the insertion algorithms to ensure that the new information is stored successfully in the array.
e. Change the function to find an athlete by name:
 Replace the sequential access algorithm to operate on the arrays with a binary search algorithm. To implement this, the array’s data must be sorted. You may refer to an online example available at Array.prototype.sort() to learn about sorting data in arrays.
Task 4: Debug code
Debug the changes implemented in Task 3 using a suitable tool provided by an integrated development environment (IDE), such as Chrome DevTools. Create a word-processed document containing the following:
1. Trace the code execution to detect errors in your code. Include screenshots of your files within the debugger and the process of tracing the code execution. For example, if you are using Chrome DevTools, include screenshots of the sources panel showing your TaskThree.html and TaskThree.js files, and the event listener breakpoints showing the process of stepping through your code and the variable values in the Scope panel. (You may refer to an online example available at Get Started with Debugging JavaScript in Chrome DevTools to learn about debugging Javacript in Chrome DevTools).
2. Outline the errors found during debugging.
3. Correct the errors that you have found and save your files.
Task 5: Produce documentation
Use the appropriate documentation tool to generate the JavaScript documentation for your code.


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

发表评论