A 22-year-old woman is evaluated during a routine office visit. She is pregnant at 38 weeks' gestation. She reports no dysuria, urgency, fever, or chills. Medical history is unremarkable. Her only medication is a prenatal vitamin.

On physical examination, temperature is 37.0 °C (98.6 °F), blood pressure is 100/70 mm Hg, pulse rate is 80/min, and respiration rate is 16/min. Abdominal examination is consistent with her stage of pregnancy; no costovertebral angle tenderness is noted. The remainder of the examination is unremarkable.

Urine dipstick is positive for nitrites and leukocyte esterase. Urine culture grows greater than 100,000 colony-forming units/mL of Escherichia coli susceptible to ampicillin, nitrofurantoin, and trimethoprim-sulfamethoxazole.

Which of the following is the most appropriate treatment?