Question: Define a function named tokph which has two inputs. Both of these inputs will have Number values. This first input represents the number of miles

 Define a function named tokph which has two inputs. Both ofthese inputs will have Number values. This first input represents the numberof miles traveled. The second input represents the number of hours the

Define a function named tokph which has two inputs. Both of these inputs will have Number values. This first input represents the number of miles traveled. The second input represents the number of hours the travel required and will NOT be 0 . Your function must calculate and return a Number. The returned value represents the speed traveled in kilometers per hour. Your function should start by multiplying the first parameter by 1.60934 (1 mile is 1.60934 kilometers). That product should then be divided by the second input. Your function must return the result of that division. Sample test cases: tokph (1.,1.) would evaluate to 16.0934 (finds bug in how first parameter converted) toKph (1.,1.) would evaluate to -16.0934 (finds bug if second parameter not used correctly) A. For this question you will need to use the following library function: - Math. floor (num) evaluates to the largest whole number that is less than or equal to num. Define a function named ckToR which has two inputs. The two inputs are floats representing the cyan and black levels, respectively, of a color represented using CMYK. Your function will calculate and return a string stating the red level of this color (for the much more common RGB format). Your function should calculate 255 * (1 - cyan level) * (1 - block level). Because RGB colors are always reported as a whole number, your function will need to call math. floor to get the final red level. The function needs to return a string with the text Red level is red level the function calculated. Sample test cases: ckToR(.81,.) would evaluate to "Red level is 48" (finds bug in how first parameter used) ckTOR(.,0.3) would evaluate to "Red level is 178" (finds bug in how second porameter used) ckToR(0.5,0.36) would evaluate to "Red level is 81" (finds bug if both parameters are not used) Part B (4 points) - function which calls library functions You will need a JavaScript (NodeJS) repl to solve part B. For this question you will need to use the following library function: ensure that all instances of x are replaced. function should return a no-longer-funky String. Sample test cases: (finds bug if " U " not replaced correctly) defunk("Live 4 love") would evaluate to "Live for love" (finds bug if "4" not replaced correctly) defunk( "I would die 4U ") would evaluate to "I would die for you" (finds bug when the result of first function call is not used to make the second function call) Part C (4 points) - function calling user-defined functions ust below those function definitions. t is calculated, your function should return the tire's velocity in kilometers per hour. Sample test cases: vealMetric (0.001,1000,1.0) would evaluate to NaN (finds bug in handling of negative first parameter) vealMetric (0.001,1000,1.0) would evaluate to NaN (finds bug in handling of negative second parameter) ealMetric (.001,1.,) would evaluate to Infinity (finds bug in handling of third parameter equivalent to 0 ) ealMetric (0.001,10000,1.0) would evaluate to 16.0934 (finds bug in performing actual equation)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!