I was reading the book Fuzzy Logic by Timothy. J .Ross
I don't understand how this defuzzification result was obtained.
This is the example in the book:

The centroid method equation is :

I don't understand how the equations for $\mu_B(Z)$ was obtained. That is I don't understand for example, how from 3.6-4 it was integrated as $(z-3.0)\over 2$
Also in the weighted average method ,

I don't understand how the centroid values of respective shapes are obtained.
Can someone please help me to understand this?
The values are read from the graph, and straight-looking parts are interpreted as straight lines, meaning: assumed to be of the form $kx +b$ in the corresponding interval. Then the $k$ and $b$ are solved to find equation for the line. If $z = 3.6$ then $\frac{z-3}{2} = 0.3$ for example and at $z = 4$, it's $\frac{z-3}{2} = 0.5$.