There are three heat transfers involved in this problem.
#"Heat gained by coffee + heat gained by sugar + heat lost by water" = 0#
#q_1 + q_2 + q_3 = 0#
The formula for the heat gained or lost by a substance is
#color(blue)(bar(ul(|color(white)(a/a)q = mcΔTcolor(white)(a/a)|)))" "#
∴ #m_1c_1ΔT_1 + m_2c_2ΔT_2 + m_3C_3ΔT_3 = 0#
In this problem,
#m_1 = "5.0 g"#; #color(white)(ml)c_1 = "0.20 J·°C"^"-1""g"^"-1"#; #color(white)(ll)ΔT_1 = T_"f" - T_"i" = T_"f"color(white)(l) "- 25.0 °C"#
#m_2 = "15.0 g"#; #color(white)(ll)c_2 = "0.30 J·°C"^"-1""g"^"-1"#; #color(white)(ll)ΔT_2 = T_"f" - T_"i" = T_"f"color(white)(l) "- 25.0 °C"#
#m_3 = "200.0 g"#; #c_3 = "4.184 J·°C"^"-1""g"^"-1"#; #ΔT_3 = T_"f" - T_"i" = T_"f"color(white)(l) "- 100.0 °C"#
#q_1 = m_1c_1ΔT_1 = 5.0 color(red)(cancel(color(black)("g"))) × "0.20 J·°C"^"-1"color(red)(cancel(color(black)("g"^"-1"))) × (T_"f"color(white)(l) "- 25.0 °C") = 1.0T_"f"color(white)(l) "J·°C"^"-1" "- 25.0 J"#
#q_2 = m_2c_2ΔT_2 = 15.0 color(red)(cancel(color(black)("g"))) × "0.30 J·°C"^"-1"color(red)(cancel(color(black)("g"^"-1"))) × (T_"f"color(white)(l) "- 25.0 °C") = 4.5T_"f" color(white)(l)"J·°C"^"-1" "- 112.5 J"#
#q_3 = m_3c_3ΔT_3 = 200.0 color(red)(cancel(color(black)("g"))) × "4.184 J·°C"^"-1"color(red)(cancel(color(black)("g"^"-1"))) × (T_"f"color(white)(l) "- 100.0 °C") = 836.8T_"f" color(white)(l)"J·°C"^"-1" "- 83 680 J"#
#q_1 + q_2 + q_3 = 1.0T_"f"color(white)(l) "J·°C"^"-1" "- 25 J" + 4.5T_"f" color(white)(l)"J·°C"^"-1" "- 112.5 J" + 836.8T_"f" color(white)(l)"J·°C"^"-1" "- 83 680 J" = 0#
#842.3T_"f"color(red)(cancel(color(black)("J")))·"°C"^"-1"color(white)(l) "- 83 818" color(red)(cancel(color(black)("J"))) = 0#
#T_"f" = "83 818"/("842.3 °C"^"-1") = "99.5 °C"#