Let $A(x)$ be the area between the function and the $x$-axis and between the $y$-axis and the vertical line at a given $x$. Consider the following function.

$$f(t) = \begin{cases} - 2t + 8, & t \leqslant 3 \\ 2,& t > 3 \end{cases}$$
the textbook has the answer
$$A(x) = \begin{cases}8x - x^2, & 0 \leqslant x \leqslant 3 \\ 2x + 9,& {x > 3} \end{cases}$$
My rough work: area of triangle is $\frac 12 \cdot (-2x + 8)$, area of rectangle is $(2)(x-3)$.
Please explain how to get the answer.
Ok if you haven't heard of integration, you can solve this geometrically.
For the interval $[0,3]$ consider it as a trapeziod. Call this area $A_1$ the trapeziod for $x\leqslant3$ which given the defined function $f(t)$ will have area: $$A_1=\frac{1}{2}(b^1+b^2)\cdot l\tag{1}$$ Where $b^1$ and $b^2$ are the side lengths, defined by $f(t)$ and $l$ is the width, defined by $t$. So that expression $(1)$ becomes: $$A_1=\frac{1}{2}[(8) + (-2t+8)]t$$ $$=\frac{1}{2}(-2t+16)t$$ $$=\frac{1}{2}(-2t^2+16t)$$ $$=-t^2+8t$$ If your area function is defined in terms of x you now have: $$A(x)=8x-x^2, 0\leqslant x \leqslant3$$ For $x>3$ it appears the textbook takes into account the trapeziod shape. So the second part of the piecewise function is defined here as $2(x-3)+15$. The $15$ comes from $A(x)$ evaluated at $x = 3$. This expands to:
$$A(x)=2x + 9, x > 3$$ So as required you have your piecewise function: $$A(x) = \begin{cases}8x - x^2, & 0 \leqslant x \leqslant 3 \\ 2x + 9,& {x > 3} \end{cases}$$