c++languageWrite a Program that can be used to sort, search and report a database of personal contacts, phone numbers, birth day, and address. The birth day should be type Date (a struct with month as string, day and year as integers). All the input data are saved in a file. The output file should have the sorted data based on the last names. Also, search with a birthday month, and should report all those persons name and birthdays whose birthday is in that month. Use functional decomposition to solve the problem. Generate Data file of at least 20 records to test your code. The program must use functions, structs, and arrays HINTS: First split the program into several parts 1. Define three structs called Address, Date and Record as below: struct Address int houseno string streetname; string streetType; string city; string state; int zip struct Date string month; int day int year }: struct Record string last string first; Date bday; Date itself is a struct as defined above; Address address; int phoneNo 2. Functions: Main (You have to change the order to make it to work, here only important steps are provided) Must declare an array of type Record, declare it dynamically Declare N (total number of records) Use file input option to read all the records from an input file where all the data are stored. Now declare a variable called option, and get a value for option using cin statement. Display a menu like the below: To sort the records: Option is 1 To search with a search criterion: Option is 2 If option 1, then do the following: Declare SortOption as integer Display menu: Enter 1 to sort using first name Enter 2 to sort using last name Enter 3 to sort using birth month Prompt the user to enter sort option Get a value for sortOption using cin statement Call the function Sort that takes three inputs: record array of type Record, N, and sortOption Call Display function to display all the records after sorting. Display function displays the records in sorted order as well as put the sorted list in an output file If option 2, then Declare a variable called birthMonth as type integer Prompt the user to enter a month Get value for birthMonth using cin statement Call the function Search that takes the record array, number of records (N) and birthMonth as inputs and will display only those persons name, their birthdate and phone number whose birthdays are falling in that month. End main Function Sort will sort all the records based on the criterion selected. Function Search will search with birthMonth, and display corresponding records Function Display will display all the records PROJECT must include (i) Source code (epp) with comments added. Comments must be sufficient to explain your program. About the two functions take help from blackboard. (ii) A flow chart explaining the details (iii Result files iv) Report (a word document) Show transcribed image text Write a Program that can be used to sort, search and report a database of personal contacts, phone numbers, birth day, and address. The birth day should be type Date (a struct with month as string, day and year as integers). All the input data are saved in a file. The output file should have the sorted data based on the last names. Also, search with a birthday month, and should report all those persons name and birthdays whose birthday is in that month. Use functional decomposition to solve the problem. Generate Data file of at least 20 records to test your code. The program must use functions, structs, and arrays HINTS: First split the program into several parts 1. Define three structs called Address, Date and Record as below: struct Address int houseno string streetname; string streetType; string city; string state; int zip struct Date string month; int day int year }: struct Record string last string first; Date bday; Date itself is a struct as defined above; Address address; int phoneNo
2. Functions: Main (You have to change the order to make it to work, here only important steps are provided) Must declare an array of type Record, declare it dynamically Declare N (total number of records) Use file input option to read all the records from an input file where all the data are stored. Now declare a variable called option, and get a value for option using cin statement. Display a menu like the below: To sort the records: Option is 1 To search with a search criterion: Option is 2 If option 1, then do the following: Declare SortOption as integer Display menu: Enter 1 to sort using first name Enter 2 to sort using last name Enter 3 to sort using birth month Prompt the user to enter sort option Get a value for sortOption using cin statement Call the function Sort that takes three inputs: record array of type Record, N, and sortOption Call Display function to display all the records after sorting. Display function displays the records in sorted order as well as put the sorted list in an output file If option 2, then Declare a variable called birthMonth as type integer Prompt the user to enter a month Get value for birthMonth using cin statement Call the function Search that takes the record array, number of records (N) and birthMonth as inputs and will display only those persons name, their birthdate and phone number whose birthdays are falling in that month. End main Function Sort will sort all the records based on the criterion selected. Function Search will search with birthMonth, and display corresponding records Function Display will display all the records PROJECT must include (i) Source code (epp) with comments added. Comments must be sufficient to explain your program. About the two functions take help from blackboard. (ii) A flow chart explaining the details (iii Result files iv) Report (a word document)
Expert Answer
Answer to Write a Program that can be used to sort, search and report a database of personal contacts, phone numbers, birth day, a…