Answered step by step
Verified Expert Solution
Question
1 Approved Answer
function name (price, qty, taxRate) a. Three numbers (decimal values) are passed to this function. First parameter holds the unit price of an item.
function name (price, qty, taxRate) a. Three numbers (decimal values) are passed to this function. First parameter holds the unit price of an item. Second parameter holds the quantity ordered and last parameter holds the tax rate to be applied. Your task is to calculate the subtotal, tax, total cost and display your output in console as in sample below (values should be rounded to two decimal place for display purposes): Sample output when values (2.65, 3, 0.1) are passed to this function: Sub total: $7.95, Tax: $0.79, Total: $8.74 function name (num, multiplyBy) a. Use the digits of first number passed to this function to multiply by the second number passed to the function and display the results separated by comma (as shown in sample below) as one string. Sample output when (123, 3) were passed to this function: 3, 6, 9 function name (date) b. If date passed to the function is in the passed, display how many day is passed and if it is in the future, display how many days left to that date. Pay attention to the singular & plurar day vs days when is more than one day Sample output when a future date is passed to this function: There is 3 days left to that date Sample output when a date in the past is passed to this function: That day was 1 day ago function name (str) a. This function receives an string. Your task is to find all even numbers (digits) and sum them up then display the total value in console. For example if following string is passed to this function "112, sf34, 4)-k)" Result should be: The sum of all even numbers: 10 function name (str) a. This function receives an string. Your task is loop through the each character of the string and separate all digists/letters/special characters. Display all digits at the beginning, followed by letters then the special chars and display result in console. For example if following string is passed to this function "ha1m2i3:n)" Result should be: 123hamin:) function name (num, str). a. The digits of the first number will be Added or Multiplied based on the string passed (add/multiply) and display the results in the console. For example if the string (1234, "add") is passed to this function. Result should be: The sum of 1234 is 10. if followings are passed to this function (1234, "Multiply") Result should be: The product of 1234 is 24. function name (list) a. Create an unordered list where items are the elements of array passed to this function. For example if array ["A", "B", "C", "D"] is passed to this function, your output would be A B C D
Step by Step Solution
There are 3 Steps involved in it
Step: 1
4 Then you have to save the code 5 Sav...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started