CIS 111 Chapter Notes - Chapter All: Pythagorean Theorem, Hypotenuse

148 views2 pages
CIS 111 Extra Credit Project Each of the 6 exercises will add 1.5 points to your exam scores if it is done
correctly.
To receive any points for this extra credit project you must also submit project 5.
Create a text file named ExtraCredit.js that you will enter the following functions. Upload this file to your
project 5 folder, p5, on the uoregon server to submit it. Also send an email to rlittle@uoregon.edu to let
me know that you have uploaded the file.
1. Write a JavaScript function called getHypotenuse that returns the length of the hypotenuse of
a right triangle given the length of the other two sides. You can utilize the Pythagorean
Theorem.
Test your function with the following data.
getHypotenuse(3, 4) should return 5
getHypotenuse(6, 8) should return 10
2. Rewrite the above function as an arrow function.
3. Write a JavaScript function called pyramidVolume that returns the volume of a pyramid given its
length, width and height.
Test your function with the following data.
pyramidVolume(10, 10, 10) returns 333.33
pyramidVolume(25, 15, 10) returns 1000
4. Rewrite the above function as an arrow function.
5. Write a JavaScript function that given an array of numbers, returns another array of the same
numbers in reverse order.
Providing the function this array [23, 12, 16, 700, 99, 27]
should return this array [27, 99, 700, 16, 12, 23]
6. Write a JavaScript function that given an array of numbers, returns another array of the same
numbers sorted from the smallest number to the largest number.
Providing the function this array [23, 12, 16, 700, 99 , 27]
should return this array [12, 16, 23, 27, 99, 700]
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions