Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Exercise 1.8 (1 points)
- *
- * Create a function called `calculateArea()` that takes one argument, the
- * diameter of a circle. The function should return the area of the circle,
- * with 4 decimals.
- *
- * Answer with the result if the diameter is 17. ( hint: `pi()` )
- *
- * Write your code below and put the answer into the variable ANSWER.
- */
- function calculateArea($arg1) {
- $c = pi() * pow(($arg1/2), 2);
- $with_4_decimals = round($c, 4);
- return 'hint: ' . $with_4_decimals;
- }
- $ANSWER = calculateArea(17);
- // I will now test your answer - change false to true to get a hint.
- echo $dbwebb->assertEqual("1.8", $ANSWER, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement