#### Answer

Total cost = $\$787.50$

#### Work Step by Step

To find the total cost, there is a need to know the area of the rectangular floor.
The area of a rectangle is given by the formula $A=lw$ where l = length and w = width.
The floor has a length of 21 feet and a width of 15 feet.
Solve for the area of the floor to obtain:
$A= lw
\\A = 21(15)
\\A= 315 \text{ square feet}$
Each square yard of carpet costs $\$22.50$.
Each yard is equivalent to 3 feet.
Thus, 1 square yard = $3(3) = 9 \text{ square feet}$.
This means that 9 square feet of carpet costs $\$22.50$.
Solve for the cost of each square foot of carpet by dividing the cost per square yard by $9$:
$\text{cost of carpet per square foot} = \dfrac{\$22.50}{9}=\$2.50$
Multiply the cost of the carpet per square foot to the area of the floor to obtain:
Total cost = $\$2.50(315) = \$787.50$