Huh? None of the Hobbits really had rank. Even if we take Frodo as Esquire and assume his cousins are of equal rank (if esquire even probably means diddly to Hobbits) Sam's still just a Gardnergardener. Gimli while not heir apparent still has a good solid claim to the throne.
So DainDáin II Ironfoot is king.
Heir apparent is his son Thorin III Stonehelm
Since I couldn't find a DOB for Durin VII (Thorin III Stonehelm's son)...I'm going to assume he wasn't born yet
Next would be Balin but he's dead....granted they don't know it at the time...
So Dwalin is 2nd in line for the throne
After Dwalin would be OinÓin...but OinÓin is also dead so...
GloinGlóin is 3rd in line and Gimli is his heir
4th isn't an insignificant spot...especially in times of war (something about rulers personally leading the troops does that). It's certainly higher than Boromir being son of Denethor as Stewards are ultimately just high ranking servants.
That said the Fellowship was a group of VOLUNTEERS and weren't chosen by any save themselves.