So first you would have to find how much each one would be if you were buying one individual book. For that you would do 31.36/4 to get $7.84. Then since you found that for only 1 book, you would need to multiply that by 3 to get $23.52
Let us assume then that the center is the origin. If the major axis is 18, then a = 9 and a^2=81. If the minor axis is 16, then b = 8 and b^2=64. Now you can write the equation. Remember that this ellipse is vertical and so a^2 goes under y^2