The sum of the oxidation numbers always equals the charge on the ion. If we deal with a neutral molecule, the oxidation numbers of the constituent atoms must sum to ZERO.
Most of the time, hydrogen, in its compounds has an oxidation state of #+I#, i.e. it is conceived to have donated 1 electron, and we treat it as #H^+#; and oxygen in its compounds has an oxidation state of #-II#, it is conceived to have accepted 2 electrons, and we treat it as #O^(2-)#. (Peroxides and hydrides are the exceptions!).
So for #"ammonium biphosphate, "(NH_4)_2HPO_4#, the oxidation number of hydrogen is #+I#, and that of oxygen #-II#; with some simple algebra, I can assign a #-III# state to nitrogen, and a #+V# state to phosphorus. If you add these oxidation states up: #2xx-III+8xxI+V-4xxII+I=0# you get zero as is required for a neutral compound or salt.
And for #XeOF_4#, the oxidation number of #Xe=VI+ (O=-II, F=-I)#, for #C_8H_10#, the carbon has an average oxidation number of #-10/8# (the terminal carbons are #-III#, and the methylene, #CH_2#, carbons are #-II#, vinyl, #=CH# carbons are #-I#; the average is #-10/8#.
And for #BaSO_4#, #Ba=+II, S=+VI, and O=-II#.
I have thrown a lot of facts and calculations at you. Mind you, you posed an open-ended question, which required a lot of background. The point to learn is that the sum of the oxidation numbers equals the charge on the ion. I think these calculations are well within the grasp of a 2nd year chemistry student. If there are further questions, post them, and someone will help you.