What do gram-positive cocci, gram-negative rods and cocci in my sputum culture mean?

Why is a sputum culture test taken?