The compound interest formula is:
[tex]A=P(1+\frac{r}{n})^{nt}[/tex]
where A is the final amount, P is the initial investement, r is the interest rate in decimal form and n is the number of times the interest is compounded in any given time t.
In this case P is 512, r=.05, n=6 (in one hour the interest is compounded six times) and t is 1, then we have:
[tex]\begin{gathered} A=512(1+\frac{0.05}{6})^{6\cdot1} \\ =538.14 \end{gathered}[/tex]
Therefore the final amount is $538.14 and the interest earned is $26.14