The bond with six months left to maturity has a semiannual discount rate of 0.03/2 = 0.015 or 3.0% on an annual bond equivalent yield (BEY) basis. Since the bond will only make a single payment of 101.50 in six months, the YTM is the spot rate for cash flows to be received six months from now.
The one-year bond will make two payments, one in six months of 2 and one in one year of 102. We can solve for the one-year spot rate in the equation:

where
S1.0 is the annualized 1-year spot rate.
Solving we get: S1.0 = 4.01005%.
Using the 6-month and 1-year spot rates, we can use the same approach to find the 18-month spot rate from the equation:

where
S1.0 is the annualized 18-month spot rate.
Solving we get: S1.5 = 5.0338823%.