There are various assumptions and approximations
made that are likely stated in the text before the problem was assigned.
The slits are approximated as being sources of outgoing waves of the
same wavelenght with magnitude independent of direction of either the
incoming or outgoing waves. In that case, taking the
dotted line as $y=0$, and $y$ as the position of the measurement on
the right-hand screen, there are four possible paths that the light
can travel to reach the screen. These are
upper left slit to upper right slit to screen
with path length $\ell_1+\ell_3$,
upper left slit to lower right slit to screen
with path length $\ell_2+\ell_4$,
lower left slit to upper right slit to screen
with path length $\ell_2+\ell_3$,
lower left slit to lower right slit to screen
with path length $\ell_1+\ell_4$,
where from the geometry
\begin{eqnarray}
\ell_1 &=& \sqrt{\frac{(d_2-d_1)^2}{4}+D_1^2}
\\
\ell_2 &=& \sqrt{\frac{(d_2+d_1)^2}{4}+D_1^2}
\\
\ell_3 &=& \sqrt{\frac{(d_2-2y)^2}{4}+D_1^2}
\\
\ell_4 &=& \sqrt{\frac{(d_2+2y)^2}{4}+D_1^2}
\,.
\end{eqnarray}
The amplitude at the screen is then proportional to
\begin{equation}
A \propto e^{i\frac{2\pi}{\lambda}(\ell_1+\ell_3)}
+ e^{i\frac{2\pi}{\lambda}(\ell_2+\ell_4)}
+ e^{i\frac{2\pi}{\lambda}(\ell_2+\ell_3)}
+ e^{i\frac{2\pi}{\lambda}(\ell_1+\ell_4)}
\end{equation}
and the intensity is the magnitude of the amplitude squared
\begin{equation}
I = |A|^2 \propto \cos^2\frac{2\pi}{\lambda}\frac{\ell_2-\ell_1}{2}
\cos^2\frac{2\pi}{\lambda}\frac{\ell_3-\ell_4}{2}
\,.
\end{equation}
In order for the approximations of the slits above to be valid,
the spacing of the slits needs to be small compared to the separations.
So $D_1,D_2 \gg d_1,d_2$, and expanding the square root
\begin{eqnarray}
\ell_1 = D_1+\frac{(d_2-d_1)^2}{8D_1}+...
\nonumber\\
\ell_2 = D_1+\frac{(d_2+d_1)^2}{8D_1}+...
\nonumber\\
\ell_3 = D_2+\frac{(d_2-2y)^2}{8D_2}+...
\nonumber\\
\ell_4 = D_2+\frac{(d_2+2y)^2}{8D_2}+...
\end{eqnarray}
so that
\begin{eqnarray}
\frac{\ell_2-\ell_1}{2} = \frac{d_2d_1}{4D_1} +...
\nonumber\\
\frac{\ell_3-\ell_4}{2} = \frac{d_2y}{2D_2} +...
\end{eqnarray}
This gives
\begin{equation}
I \propto \cos^2\left (\frac{2\pi}{\lambda} \frac{d_1d_2}{4D_1}\right)
\cos^2\left (\frac{2\pi}{\lambda} \frac{d_2y}{2D_2}\right)
\end{equation}
The maximum is at $y=0$, which is normally what is called
the central maximum. Calling this $I_0$, the result is
\begin{equation}
I = I_0 \cos^2\left (\frac{2\pi}{\lambda} \frac{d_2y}{2D_2}\right) \,.
\end{equation}
I may have made factor of 2 errors, and I'm too lazy to check, but still
it appears to me that the answer you give is in error, and should
not include the first $\cos^2$ term