To make the calculations easy, I am going to assume that the area of the bottom of the barrel is #A = 100" cm"^2#
At a flow rate of #240" cm"^3"/s"# the slope of the line will be:
#m = (250" cm"^3"/s")/(100" cm"^2) = 2.5" cm/s"#
The line starts that the point #(0,0)#, therefore, we can use the point slope form of the equation of a line to describe the depth:
#d = (2.4" cm/s")(t-0)+0; 0<=t<=18" s"#
Simplify by eliminating the 0s:
#d = (2.4" cm/s")t; 0<=t<=18" s"#
The next segment of the graph must touch the previous at #t = 18" s"#:
#d = (2.4" cm/s")18" s"#
#d = 43.2" cm"#
We need the slope of the next segment where the flow rate changes to #140" cm"^3"/s"#:
#m = (140" cm"^3"/s")/(100" cm"^2) = 1.4" cm/s"#
We use the point slope form of the equation of a line to add write the equation of the next segment from #t = 18" s"# to #t = 32" s"#:
#d = {((2.4" cm/s")t; 0<=t<=18" s"),((1.4" cm/s")(t-18" s")+43.2" cm"; 18< t<=32" s"):}#
We can distribute the slope through the ()s to simplify the second segment:
#d = {((2.4" cm/s")t; 0<=t<=18" s"),((1.4" cm/s")t+18" cm"; 18< t<=32" s"):}#
At #t = 32" s"#, the flow stops and the depth from #t = 32" s"# to #t = 40" s"#, the depth is the value at #t = 32#
#d = (1.4" cm/s")32" s"+18" cm"#
#d = 62.8" cm"#
Add the third segment:
#d = {((2.4" cm/s")t; 0<=t<=18" s"),((1.4" cm/s")t+18" cm"; 18< t<=32" s"),(62.8" cm"; 32" s" < t <= 40" s"):}#
Here is a sketch of the 3 segment in red, green and blue, respectively: