Lily is preforming a survey about the students' majors in her class and needs you to write a program to help her. You plan on writing a program which asks for input and writes text files for further analysis later (Lab 7B).
Input
The first line of input consists of a person's first name. Then, the second line of input will consist of that person's last name. Finally, the person will input their two-letter abbreviation for their major.
File Output
Your program should output two three different text files:
recent.txt
should be overwritten with the most recent first and last
name inputted into the program. The first and last name should be separated
by a single space, and the line should end with a line terminator (\n
,
ASCII value \(10\)).
people.txt
should be appendend to with the most recent entry in the
format Last,First,Major
. Make sure to include a line terminator at the end
of the line.
majors.txt
should be appendend to with just the most recent major
entered. Make sure to include a line terminator at the end of the line.
Console Output
Any output you make to the console will be ignored.
Example Interaction
First Name: Jack
Last Name: Rosenthal
Major: CS
recent.txt
is overwritten with the following contents:
Jack Rosenthal
people.txt
has the following line appended:
Rosenthal,Jack,CS
majors.txt
has the following line appended:
CS