Reference no: EM132208421
Write the program in c++ only
A file of student records contains name, gender (M or F), age (in years), and marital status(S or M) for each student. Design an algorithm that will prompt for filename, make sure the input file exists. then read the file and generate a report.
The first part of the output report are the Eligible Bachelors.
If any single men are over 30 years of age, print their names and ages. Also, while you are reading the file, calculate the numbers of married men, single men, married women, and single women (this will require multiple counters...). Print the totals in the Student Summary section.
Make nice headings and format for your output file (see example below). No other output is generated in the runtime console window. (Although while you are testing, you may want to send output there to make sure you are reading the file correctly).
Format of output file
Eligible Bachelors
Name Age
Slkdfj slkd 31
Slkd fslkdf 35
Student Summary Report
Married men: xx
Married women: xx
Single men: xx
Single women: xx
Total students xx
Create the file students.txt listed below for testing. Print the output file as your runtime output. I will test your program on another file that I create.
So you might want to create another file to try out! Remember to use Notepad, and remember to hit "Enter" at the end of the last line, otherwise you may not read out the last line correctly.
Example of input file format: (Notice that the # character is used to indicate the end of the name, you will have to use getline with ‘#' as the delimiter character.)
Name#gender age maritalstatus
Jenny Smith#F 25 M
John Brown#M 32 S
Tom Jones#M 22 S
Ann Jones#F 35 M
Sue Davis#F 20 S
Bugs Bunny#M 45 S
Captain Kirk#M 50 S
Lucy Ricardo#F 39 M