Given 5 boys and 4 girls. We are calculating two scenarios:
1. All boys sit together:
Treat the 5 boys as a single unit. We then arrange this unit along with the 4 girls, resulting in 5 units to arrange. The number of ways to arrange these 5 units is \( 5! \). Within the boys' unit, the 5 boys can be arranged in \( 5! \) ways.
The total arrangements for all boys sitting together are:
\[
\text{Ways for all boys together} = 5! \times 5! = 120 \times 120 = 14400.
\]
2. No boys sit together:
First, arrange the 4 girls. This can be done in \( 4! \) ways.
This arrangement creates 5 possible positions where the boys can be placed (one before the first girl, one between each pair of girls, and one after the last girl).
The number of ways to place the 5 boys in these 5 positions is \( 5! \).
The total arrangements for no boys sitting together are:
\[
\text{Ways for no boys together} = 4! \times 5! = 24 \times 120 = 2880.
\]
Summing the results from both scenarios:
\[
\text{Total number of ways} = 14400 + 2880 = 17280.
\]
Thus, the total number of ways is \( \boxed{17280} \).