Concept:
In a perfectly inelastic collision:
Linear momentum is conserved
Loss of kinetic energy appears as internal energy (heat)
If bodies are of the same material, they attain the same rise in temperature
Step 1: Given data
Mass of ball $A$:
\[
m_1 = 15\ \text{kg}, \quad v_1 = +10\ \text{m/s}
\]
Mass of ball $B$:
\[
m_2 = 25\ \text{kg}, \quad v_2 = -30\ \text{m/s}
\]
Specific heat:
\[
c = 31\ \text{cal/kg-}^\circ\text{C}
\]
Step 2: Find common velocity after collision
Using conservation of momentum:
\[
m_1v_1 + m_2v_2 = (m_1+m_2)v
\]
\[
15(10) + 25(-30) = 40v
\]
\[
150 - 750 = 40v \Rightarrow v = -15\ \text{m/s}
\]
Step 3: Initial kinetic energy
\[
K_i = \frac{1}{2}m_1v_1^2 + \frac{1}{2}m_2v_2^2
\]
\[
K_i = \frac{1}{2}(15)(10^2) + \frac{1}{2}(25)(30^2)
= 750 + 11250 = 12000\ \text{J}
\]
Step 4: Final kinetic energy
\[
K_f = \frac{1}{2}(40)(15^2) = 4500\ \text{J}
\]
Step 5: Energy lost in collision
\[
\Delta K = K_i - K_f = 12000 - 4500 = 7500\ \text{J}
\]
Convert into calories:
\[
Q = \frac{7500}{4.2} \approx 1786\ \text{cal}
\]
Step 6: Rise in temperature
Total heat capacity of both balls:
\[
(m_1+m_2)c = 40 \times 31 = 1240\ \text{cal/}^\circ\text{C}
\]
\[
\Delta T = \frac{Q}{(m_1+m_2)c}
= \frac{1786}{1240}
\approx 1.44^\circ\text{C}
\]
Conclusion:
The rise in temperature of each ball is:
\[
\boxed{1.44^\circ\text{C}}
\]