Answer
(a) The mass of the planet is $1.48\times 10^{25}~kg$
(b) The mass of the star is $5.23\times 10^{30}~kg$
Work Step by Step
(a) We can use the free-fall acceleration $g_p$ and the planet's radius $R_p$ to find the planet's mass $M_p$. Note that the planet's radius is $9.0\times 10^6~m$.
$g_p = \frac{G~M_p}{R_p^2} = 12.2~m/s^2$
$M_p = \frac{(12.2~m/s^2)~R_p^2}{G}$
$M_p = \frac{(12.2~m/s^2)(9.0\times 10^6~m)^2}{6.67\times 10^{-11}~m^3/kg~s^2}$
$M_p = 1.48\times 10^{25}~kg$
The mass of the planet is $1.48\times 10^{25}~kg$
(b) We can convert the orbital period $T$ to units of seconds.
$T = (402~days)(24~hr/day)(3600~s/hr)$
$T = 3.47\times 10^7~s$
We can use the orbital radius $R$ and the orbital period to find the mass of the star $M_s$.
$T^2 = \frac{4\pi^2~R^3}{G~M_s}$
$M_s = \frac{4\pi^2~R^3}{G~T^2}$
$M_s = \frac{(4\pi^2)(2.2\times 10^{11}~m)^3}{(6.67\times 10^{-11}~m^3/kg~s^2)(3.47\times 10^7~s)^2}$
$M_s = 5.23\times 10^{30}~kg$
The mass of the star is $5.23\times 10^{30}~kg$