Solution (source code)

= Solution

Write the charge in units of $e$ as $Q=aI_z+b(B+S)$. The <proton> and <neutron> have $(I_z,B+S)=(1/2,1)$ and $(-1/2,1)$, so their measured charges imply $1=a/2+b$ and $0=-a/2+b$. Thus $a=1$, $b=1/2$:
$$
\boxed{Q=I_z+\frac{B+S}{2}.}
$$
This is the <Gell-Mann--Nishijima formula>, with the full <flavor hypercharge> $Y=B+S$. Applying the <quark> <baryon number> $1/3$ and the <isospin> and <strangeness> assignments from part (a),
$$
\boxed{Q_u=\frac12+\frac16=\frac23,\quad
Q_d=-\frac12+\frac16=-\frac13,\quad
Q_s=0+\frac{1/3-1}{2}=-\frac13.}
$$
Physical <electric charges> are these numbers multiplied by the positive elementary charge $e$.