We would apply the formula for calculating compound interest which is expressed as
A = P(1 + r/n)^nt
where
A is the toatl amount after t years
t is the number of years
P is the principal or initial amount invested
n is the number of compouding periods in a year
From the information given,
P = 40000
r = 4% = 4/100 = 0.04
n = 2 because it was compounded twice in a year
t = 10
By substituting these values into the formula,
A = 40000(1 + 0.04/2)^2 x 10
A = 40000(1.02)^20
A = 59438
Interest = total amount - principal
interest = 59438 - 40000
interest = $19438