
Concept explainers
Suppose you are given a text file that contains the names of people. Every name in the file consists of a first name and last name. Unfortunately, the programmer who created the file of names had a strange sense of humor and did not guarantee that each name was on a single line of the file. Read this file of names and write them to a new text file, one name per line. For example, if the input file contains
Bob Jones Fred
Charles Ed
Marston
Jeff
Williams
the output file should be
Bob Jones
Fred Charles
Ed Marston
Jeff Williams

Want to see the full answer?
Check out a sample textbook solution
Chapter 10 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Additional Engineering Textbook Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Mechanics of Materials (10th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with C++: Early Objects (9th Edition)
Electric Circuits. (11th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)