Question: A) Write a function named avg3 that accepts three numbers and returns their average. Example: avg3(4, 2, 6) => 4 avg3(3.14159, 2.71, 2.23) => 2.69653

A) Write a function named avg3 that accepts three numbers and returns their average.

Example: avg3(4, 2, 6) => 4 avg3(3.14159, 2.71, 2.23) => 2.69653

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

Example: computeTip(10.00, 0.15) => 1.5 When this is working, modify the function to return a string, representing the tip in currency format

Example: getTip(10, 0.2) => "$2.00"

C) Write a function pizzaPSI that accepts two numbers (the cost of a pizza and the diameter in inches) and returns the cost Per Square Inch, in currency format.

Example: pizzaPSI(10.00, 12) => $0.09 pizzaPSI(23.95, 18) => $0.09

E) Write a function named sumNumbers that accepts a nonnegative number, adds up all of the numbers between 0 and the number (inclusive), and returns the sum. Use a while loop to solve this problem.

Example: sumNumbers(3) => 6 sumNumbers(6) => 21 sumNumbers(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!