(PLEASE HELP ME FOR THIS C PROGRAM ASSIGMENT) address book program receives commands from the standard input. The commands allow the user to add, edit, and delete contacts, as well as load or save...


(PLEASE HELP ME FOR THIS C PROGRAM ASSIGMENT) address book program receives commands from the standard input. The commands allow the user to add, edit, and delete contacts, as well as load or save contacts from/to a file. Sorting of contacts is extra credit. Each contact has a first name, last name, email address, and phone number.


In more detail, write a program that: Prints "Ready\n" to the stout. While the quit command has not been received: Receives a command from thestandard input (do not print a prompt, just get the command) and executes the command. Each command consists of a command code on one line, plus one or more parameters, each on a separate line. Each command code is a single character. The list of commands and associated parameters is given below: Add a new contact:


Code: a First parameter: 0-based index where the new contact should be inserted. 0 would mean in front of the first contact in the list, 1 would mean in front of the second contact in the list, and so on. This value will not be greater than the current number of contacts in the address book. Second parameter: String containing a comma delimited list of contact property values. The order is lastName, firstName, email, phonenumber Example: a 1 SMITH,AUNDREA,[email protected],8001110001


Delete a contact: Code: d First parameter: 0-based index of the contact to delete. NOTE: if the index is higher than the number of contacts - 1, do nothing. Example: d1Get a contact: Code: g First parameter: 0-based index of the contact. Example: g1Output to stout: The value of the requested field, terminated with a \n. E.g. "WILSON, HORACE, [email protected], 8001110008\n" Get a field:


Code: f First parameter: 0-based index of the contact. Second parameter: Name of the field to get. Valid values are firstName, lastName, email, phoneNumber.Example: f 1 lastName Output to stdout: The value of the requested field, terminated with a \n. E.g. "SMITH\n" Get the number of contacts in the list: Code: n Example: n Output to stdout: The number of contacts in the list, terminated with a \n. E.g.


"10\n". Load a file: Code: l First parameter: path of the file to load. Notes: The file format is CSV. There is one header line that describes the fields, then one contact per line thereafter. The order of the contact information is the same as that of the second parameter of the add command. If the address book is not empty, this command adds the loaded contacts at the end of the current list. Here is an example file (note: if you want to see what's in this file, open it in a text editor rather than a spreadsheet program).Example’s mycontacts.csv Save the contacts to a file: Code: s


First parameter: path of the file to save to. Notes: The file format is CSV, one contact per line. If the file already exists, it is overwritten.   Example: s mycontacts.csv Quit program: Code: q Example: q Output to stout: "Complete\n" Edit a contact:


Code: e First parameter: 0-based index of the contact that is to be changed. Second parameter: Name of the field to edit. Valid values are firstName, lastName, email, phone Number. Third parameter: new value of the field. Example: e 3phone Number 8002220001 Sort the contacts: Code: o Notes: Sort order is ascending based on last name, then first name, then email, then phone number. Example: o Non-Functional Requirements Each contact must be stored in a strict. All fields of the contact can contain up to 255 characters. You can assume that contact field values will not contain commas. E.g. you won't be given a first name like Andrea. Your program must store the contacts as an ordered list (not necessarily sorted). You can implement the list using either an array or a linked list. Your source code must be split into at least two files and one .h file. An example would be manic, address_book.c, address_book.h. The first executable line of your program must turn off output buffering. This is a requirement for automated testing. The following line will do the trick: setvbuf (stout, NULL, _IONBF, 0); your program must be organized into a set of cohesive functions. Your program must be properly commented. Sample stein 1 a 0 WILSON,HORACE,[email protected],8001110008 a 1 JOHNSON,ROSALIA,[email protected],8001110002 a 1 WILLIAMS,SACHIKO,[email protected],8001110003 g 2 q Sample stout 1


Ready JOHNSON,ROSALIA,[email protected],8001110002 Complete


Sample stein 2 a 0 SMITH,AUNDREA,[email protected],8001110001a 1 JOHNSON,ROSALIA,[email protected],8001110002 a 1 WILLIAMS,SACHIKO,[email protected],8001110003 d 1s my contacts .mSv Sample std out 2 Ready Complete Sample Output File 2 (mycontacts.csv) last Name ,first Name, email, phone Number SMITH,AUNDREA,[email protected],8001110001 JOHNSON,ROSALIA,[email protected],8001110002


Nov 26, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here