Question: You do not need to create an HTML web page. This should be in JavaScript. a) Write a function named average3 that accepts three numbers

You do not need to create an HTML web page. This should be in JavaScript.

a) Write a function named average3 that accepts three numbers and returns the average of the three numbers.

b) Write a function named receiveTip that accepts two numbers, the cost of a meal or other service, and the tip percentage, and returns a number representing the tip amount.

ex: getTip (10.000, 0.30) => 3.0

c) When you have this function working, modify the receiveTip function to return a string representing the tip in a currency format by using the toFixed() Method.

ex: getTip (10.00, 0.3) => $3.00 C.

d) Write a function pizzaPSI that takes two numbers, the cost of a pizza, and the diameter of the pie in inches, and returns the cost Per Square Inch (PSI) in currency format. You will need to calculate the area of the pizza to determine the cost per square inch (cost / area).

ex: pizzaPSI (10.00, 12) => $0.09

pizzaPSI (23.95, 18) => $0.09

e) Write a function named isAlphabet that accepts a character (i.e. a string of length one) and returns a true if it is a letter of the alphabet, and false if not a letter of the alphabet. The isAlphabet function should accept both uppercase and lowercase characters.

ex: isAlphabet("A") => true

isAlphabet("!") => false

isAlphabet(1) => false

f) Write a function named sumNum that accepts a single non-zero number (+ or -), adds up all of the numbers between 0 and the number (inclusive), and returns the sum. If 0 is submitted to sumNumbers, 0 should be returned. You have to use a while loop or two to calculate it.

ex: sumNum (3) => 6

sumNum (-3) => -6

sumNum (0) => 0

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!