(30%) For a constant \(a\gt0\), random variables \(X\) and \(Y\) have joint probability density function
\(f_{X,Y}(x,y)=\begin{cases}\dfrac1{a^2},&0\le x,y\le a\\[4pt]0,&\text{otherwise}\end{cases}\).
Find the cumulative distribution function and probability density function of random variable \(W=\max\!\left(\dfrac XY,\dfrac YX\right)\).