Hooke's law states that a force is needed to stretch or compress a spring by a distance of x. The force is proportional to the distance x. is written as `F = kx`

where:

F = force

k = proportionality constant or spring constant

x= length displacement from its natural length

Applying the given variable force: `F= 5` to compress a `15` -inch spring a total of `3` inches, we get:

`F=kx`

`5=k*3`

`k=5/3`

Plug-in `k =5/3` on Hooke's law, we get:

`F = (5/3)x`

Works is done when a force is applied to move an object to a new position, It can be defined with formula: `W = F*Deltax ` where:

`F` = force or ability to do work.

`Deltax` = displacement as

With variable force function: `F (x)= (5/3)x ` , we set-up the integral application for work as:

`W = int_a^b F(x) dx`

`W = int_0^7 (5/3)xdx`

Apply basic integration property: `int c*f(x)dx= c int f(x)dx.`

`W = (5/3)int_0^7 xdx`

Apply Power rule for integration: `int x^n(dx) = x^(n+1)/(n+1).`

`W = (5/3) * x^(1+1)/(1+1)|_0^7`

`W = (5/3) * x^2/2|_0^7`

`W = (5x^2)/6|_0^7`

Apply definite integral formula: `F(x)|_a^b = F(b)-F(a)` .

`W = (5(7)^2)/6 -(5(0)^2)/6`

`W =245/6 - 0`

`W=245/6` or `40.83 ` inch-lbs