Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This PHP exercise required that you declare two functions rArea() and totalCost(). You are required to create two functions. The rArea() function will accept two

This PHP exercise required that you declare two functions rArea() and totalCost().

You are required to create two functions. The rArea() function will accept two arguments and the totalCost() function will accept three arguments. Each function will perform a calculation using the arguments and then return an integer value. That returned value will then be used a sentence that is displayed using an echo() statement.

The first function will calculate the area of a property based on the height and width of the property. Using these two arguments being width and height (Reminder: area = width * height.) echo out a sentence stating A room of length " .$length . "ft and width " . $width . "ft has an area of " . rArea($length ,$width ), where area is the function return value.

The second part will require that you calculate the total cost of the property if the square foot of the property is defined by the variable $ftCost. The calculation of the property total per square foot is total area multiplied by the cost per square foot defined by the variable $ftCost. Then echo this sentence The total cost of a room oflength ." $length . "ft and width " . $width . "ft area at $" . $ftCost . "per square foot is " . totalCost($length ,$width,$cost) . where the total cost is the function returned value.

Cost Per Square Foot Area Function

Total Property Cost Calculator

$length = 20;

$width = 4;

$ftCost = 75;

//define rArea() function //ADD rArea() FUNCTION HERE

//call function rArea() echo "A room of length " . $length . "ft and width " . $width . "ft has an area of " . rArea($length ,$width ) .".";

//define totalCost() function

//ADD totalCost() FUNCTION HERE

//call function totalCost() echo "The total cost of a room of length ." $length . "ft and width " . $width . "ft area at $" . $ftCost . "per square foot is " . totalCost($length ,$width,$cost) .".";

?>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions