Starting from:

$30

Assignment-4 A simple C++ phonebook application program

Data Structures Assignment-4 
1 PART-I 1. You are asked to write a simple C++ phonebook application program. Here are the requirements for the application. • User shall add a new contact with name and phone information • User shall load contacts from a file o Each line of the input line includes name and phone information of a contact. o A sample input file is given as an example (phonebook.txt) o User shall load contacts from many files • User shall print the contacts in ascending order • User shall search for a contact with name • User shall list contacts before a particular contact. The resulting list will include all the contacts come before the given contact. • Application is required to structure data using Binary Search Tree. A sample run: ***MY PHONEBOOK APPLICATION*** Please choose an operation: A(Add) | L (Load) | S(Search) | P(Print) |F(Filter) |Q(Quit): A Enter name: MARY SMITH Enter phone: 5062396 A(Add) | L (Load) | S(Search) | P(Print) |F(Filter) |Q(Quit): A Enter file name: phonebook1.txt A(Add) | L (Load) | S(Search) | P(Print) |F(Filter) |Q(Quit): P BARBARA BROWN :4059171 ELIZABETH JONES :2736877 JENNIFER MILLER :3863726 LINDA WILLIAMS :3532665 MARGARET RODRIGUEZ :350662 MARIA ANDERSON :2211086 MARIA DAVIS :6297086 MARIA SMITH :2211086 MARY SMITH :5062396 PATRICIA JOHNSON :973437 SUSAN GARCIA :6063076 11 contacts... A(Add) | L (Load) | S(Search) | P(Print) |F(Filter) |Q(Quit): S Enter name: MARY SMITH Phone: 5062396 //The content of phonebook1.txt is given below. PATRICIA JOHNSON 973437 LINDA WILLIAMS 3532665 BARBARA BROWN 4059171 ELIZABETH JONES 2736877 JENNIFER MILLER 3863726 MARIA DAVIS 6297086 MARIA SMITH 2211086 MARIA ANDERSON 2211086 SUSAN GARCIA 6063076 MARGARET RODRIGUEZ 350662 CS 300 Data Structures Assignment-4 November 18, 2017 Dr. Fatma Cemile Serce 2 A(Add) | L (Load) | S(Search) | P(Print) |F(Filter) |Q(Quit): F Enter name: MARIA DAVIS BARBARA BROWN :4059171 ELIZABETH JONES :2736877 JENNIFER MILLER :3863726 LINDA WILLIAMS :3532665 MARGARET RODRIGUEZ :350662 MARIA ANDERSON :2211086 6 contacts…. A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): Q Bye PART- II 2. In assignment-1, you are asked to implement a similar phone book application, but you were not supposed to use Binary Search Tree. Let’s compare the performance of search operations in both solutions. a. Perform a simple search operation with your solution in assignment-1, record the time b. Perform a search for the same contact searched in (a) and record the time c. Please compare your results. Hint: you can record the execution time using the following code segment. #include void calculateElapseTime() { using namespace std; clock_t begin = clock(); //code_to_time clock_t end = clock(); double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC; }

More products