Composite Simpsons code

I am doing the code for composite Simpsons, and I want to put a table that contain the number of interval n and the approximate integral with the relative error. my question is how to do a loop that count the number of intervals and approximate solution and then to do a table display my work. I use the code: Simpson[f_,a_,b_,n_]:= module{……} and f(x) = x^2 sin(-x) from 0 to 2.