We propose a methodology for analyzing triple stellar systems that include a visual double star wherein one of the components is a single-or double-lined spectroscopic binary. By using this methodology, we can calculate the most probable values of the spectroscopic binary's inclination, the angular separation between its components, and its stellar masses, and we can even estimate the spectral types. For a few W UMaYtype eclipsing binaries, stellar radii are also determined. Moreover, we present new formulae for calculating stellar masses depending on spectral type. In this way we have studied 61 triple systems, five of them W UMaYtype eclipsing binaries with low-mass subcomponents. In addition, we study nine quadruple systems, applying the same methodology and considering them twice as a triple system. With the aim of having more accurate orbital elements, we have taken advantage of the occasion to calculate and improve orbits. In this way we have used a new speckle measurement to improve the orbital elements for the binary Hu 506 AB. Also, new visual orbits are calculated for the binaries BAG 10 Aa and LAB 6 Aa. Finally, we give a list of five spectroscopic binaries with more than 0B1 for the maximum angular separation; these should be easily observable as visual binaries by means of interferometric techniques.