The volume of a pyramid with a square base is calculated using this formula:
(B * h)/3
B= Area of base
H= Height
In order to find your area of the base, you would multiply the length and the width of the base, which, in this case, both are 3.
3*3=9ft²
B=9
h= 7
Okay, now multiply those together and you get 63.
Now, divide 63 by 3 and you get 21ft³
Hope this helps :)
If you need help on anything else, let me know.