Write a small application to maintain contact information about people. For each person in your contacts list, you will maintain the following information: name, phone number, and e-mail address. Your...


See attached images!


Please help very confused


structs


no vectors


Write a small application to maintain contact information about people. For each person in your contacts list,<br>you will maintain the following information: name, phone number, and e-mail address. Your list should be able<br>to handle a maximum of 100 people. In this program, vou will use an array of structs to store the three atributes<br>of each person in the contact list.<br>o See p. 548-549 to see how to use the isdigit library function to make this task easier.<br>Prompt for the first name separately from the last name. Do not make any assumptions about the<br>content of the name (for example, either the first or last name might be multiple words).<br>When the user inputs the email, you should validate it. For our purposes, that means the email<br>must:<br>o Contain exactly one @<br>o Following the @, it must have at least one character, followed by one dot, followed by at<br>least one character.<br>Your application should display the following menu:<br>Main Menu<br>Delete Person:<br>A - Add Person<br>Prompt for and read a last name (only). Search the array for the person, and remove their information<br>from the list. For simplicity, you may assume that all last names are unique. Display an appropriate error<br>message if the person is not in the list.<br>Note: the last name comparison should be case insensitive.<br>Note: You should not have “blank

Extracted text: Write a small application to maintain contact information about people. For each person in your contacts list, you will maintain the following information: name, phone number, and e-mail address. Your list should be able to handle a maximum of 100 people. In this program, vou will use an array of structs to store the three atributes of each person in the contact list. o See p. 548-549 to see how to use the isdigit library function to make this task easier. Prompt for the first name separately from the last name. Do not make any assumptions about the content of the name (for example, either the first or last name might be multiple words). When the user inputs the email, you should validate it. For our purposes, that means the email must: o Contain exactly one @ o Following the @, it must have at least one character, followed by one dot, followed by at least one character. Your application should display the following menu: Main Menu Delete Person: A - Add Person Prompt for and read a last name (only). Search the array for the person, and remove their information from the list. For simplicity, you may assume that all last names are unique. Display an appropriate error message if the person is not in the list. Note: the last name comparison should be case insensitive. Note: You should not have “blank" entries in your array between names. When you delete an entry you should “move up" the names after the one you deleted. D - Delete Person F - Find and Display Person L - List All People S - Save List E - Exit Find and Display a Person Prompt for and read a last name (only). Search the array for the person and display all the information about that person, or an error message if the person is not in the list. Note: just as with Delete Person, the last name comparison should be case insensitive. Enter Choice: Your program should continue to display the above menu and perform the indicated action until the "E" option is selected. You do not need to clear the screen between each operation; simply allow the display to scroll normally. The user should be able to enter either upper or lower case letters when choosing from the menu. List all People Display information about every person in the list. This information should be sorted by last name. Use the bubble sort algorithm given in your book (you will need to modify the algorithm to work with this data). The comparisons in the sort must be case insensitive. Each option is described in more detail below. Save the List Add Person: Prompt for and read a name, phone number, and e-mail address from the user. Use this information to populate the appropriate elements of array. NOTE: You must validate the phone number. For our purposes, a valid phone number is a string that contains only digits, dashes, dots, spaces, and parentheses. To keep things simple, you don't have to verify that the actual content is meaningful, you only have to verify that it doesn’t contain invalid characters (e.g., we will treat even a phone number like ..-9999) as a valid phone number). o Hint: You can access individual characters in a string using standard array notation (eg., given that phone is a string variable, you can use phone[i] in a loop to access each character. Use phone.length() to get the length of the string). Write the contents of the array to a file named "contacts.txt" in the current directory. Do not prompt the user for the name of the file; always use the file contacts.txt. Existing contents in the file (if any) should be replaced by the new data (this will happen automatically when you open the file for writing (use ofstream to open the file for writing). Each person's data should be written on a separate line of the file, in the following format: lastname, firstname,phone,e-mail All values should be comma-separated in the file (no spaces around commas). The comma is not part of the data in-memory; commas are in the file only to separate the data values. We are not expecting the user to ever look at or modify this file directly; all operations on the file are performed by your program. When your programs starts, it should automatically read and populate the array by reading the contacts.txt file. If the file is empty or nonexistent, then the program begins its operation with an empty list (this is not considered an error; it just means we have an empty list). When the program ends you should ask if the user wants to save their data. Implementation Issues Your solution should contain at least one function per Main-Menu option (i.e., a function to add a person, a function to delete a person, etc.), and you should have additional functions that perform well-defined tasks (e.g., validate the phone number). You may assume that there are no duplicate last names in the list. All updates (add, deletions) are made in-memory only; do not attempt to update the data directly in the file. At the beginning of the program, you will read the entire file into the array of structs. Your program will then add/delete from the array in memory. When the user tells you to save the data, the entire previous contents of the file are replaced with the updated list (using ofstream to write to the file will cause this behavior). You can use the functions at the end of this document to do case insensitive string comparisons.
CASE INSENSITIVE STRING COMPARISON<br>You can use the following functions to do case insensitive string comparison. Place them in your functions file<br>and include appropriate prototypes in your header file.<br>#include <string><br>#include <cstdlib><br>string stringToLower(string s)<br>{<br>string result =
stringToLower(s2); } "/>
Extracted text: CASE INSENSITIVE STRING COMPARISON You can use the following functions to do case insensitive string comparison. Place them in your functions file and include appropriate prototypes in your header file. #include #include string stringToLower(string s) { string result = ""; for (int i = 0; i < s.length();="" i++)="" result="" +="tolower(s[i]);" return="" result;="" }="" bool="" isequal(string="" s1,="" string="" s2)="" return="" stringtolower(s1)="" stringtolower(s2);="=" }="" bool="" isgreater(string="" s1,="" string="" s2)="" {="" return="" stringtolower="" (s1)=""> stringToLower(s2); }
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here