Question

In: Computer Science

In C create a program that stores contact info. The program must have the following features:...

In C create a program that stores contact info. The program must have the following features:

  • Able to store First Name, Phone Number and Birthday (MM/DD/YYYY)
  • Able to search for a specific contact using First Name, Phone Number and Birthday (find)
  • Able to delete a specific contact using First Name, Phone Number and Birthday (delete)
  • Print entire contact list
  • Show number of entries in contact list
  • Able to save Contact List to file (save)
  • Able to load Contact List from file (load)
  • Able to exit program (exit/quit)

The program must have the following structure:

  • Makefile that completely builds the entire project
  • Main file and library (implementation and header files with header guards)
  • Neat and Tidy code
  • Must have meaningful comments
  • Program must have a command and argument structure
  • Must use a linked list or dynamic array for contact list (NO REGULAR ARRAYS)
  • NO GLOBAL VARIABLES
  • Must use dynamically allocated memory that is correctly managed
  • Must use pointers
  • Must use a decision structure
  • Must give user feedback for all input (“contact list saved”, “entry ‘<user input>’ deleted”, etc.)
  • Must keep contact list sorted by First Name (sort as a new entry is added)
  • Use binary searching algorithm to find entries in contact list
  • All program features must be implemented as a function in a library.

Extra credit:

  • Used meaningful typedefs
  • Used enumerated data types
  • Used conditional operator in an inline if
  • Ask user to save contact list if they haven’t already before exiting

Solutions

Expert Solution

#ifndef ContactList_H
#define ContactList_H
#define MAX 100

typedef struct
{
int day;
int month;
int year;
}DateOfBirth;

typedef struct
{
char *FirstName;
char *PhoneNumber;
DateOfBirth Birthday;
}ContactList;

// Function to accept contact details
void acceptContact(ContactList [], int *);

// Function to search a contact information based on first name
// If found returns the found index position otherwise returns -`
int findFirstName(ContactList [], int*, char []);

// Function to search a contact information based on phone number
// If found returns the found index position otherwise returns -`
int findPhoneNumber(ContactList [], int*, char []);

// Function to search a contact information based on date of birth
// If found returns the found index position otherwise returns -`
int findBirthday(ContactList [], int*, int, int, int);

// Function to delete a contact information based on first name
void deleteFirstName(ContactList [], int *, char []);
// Function to delete a contact information based on phone number
void deletePhoneNumber(ContactList [], int *, char []);
// Function to delete a contact information based on date of birth
void deleteBirthday(ContactList [], int *, int, int, int);

// Function to display all contact information
void printContactList(ContactList [], int);

// Function to return number of contact information
void showNumberOfContacts(int);

// Function to read the file contents and stores contact information
void readFile(ContactList [], int *);
// Function to write contact information to the file
void writeFile(ContactList [], int);

// Function to display menu, accept user choice and returns it
int menu();

#endif

-----------------------------------------------------------------------------------

#include "contactList.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// Function to accept contact details
void acceptContact(ContactList cl[], int *len)
{
// Dynamically allocates memory for first name and phone number
cl[*len].FirstName = (char *) malloc(sizeof(char) * 20);
cl[*len].PhoneNumber = (char *) malloc(sizeof(char) * 20);

// Accepts first name from the user
printf("\n Enter First Name: ");
scanf("%s", cl[*len].FirstName);

// Accepts phone number from the user
printf("\n Enter Phone Number: ");
scanf("%s", cl[*len].PhoneNumber);

// Accepts birth date from the user
printf("\n Enter Date Of Birth: ");
// Accepts month from the user
printf("\n Enter Month: ");
scanf("%d", &cl[*len].Birthday.month);
// Accepts day from the user
printf("\n Enter Day: ");
scanf("%d", &cl[*len].Birthday.day);
// Accepts year from the user
printf("\n Enter Year: ");
scanf("%d", &cl[*len].Birthday.year);
// Increase the record counter by one
*len = *len + 1;
}// End of function

// Function to search a contact information based on first name
// If found returns the found index position otherwise returns -`
int findFirstName(ContactList cl[], int *len, char name[])
{
// Loop variable
int c;

// Loops till number of records
for(c = 0; c < *len; c++)
{
// Checks if parameter name is equals to current record name
if(strcmp(name, cl[c].FirstName) == 0)
// Returns the found index position
return c;
}// End of for loop
// Returns -1 for not found
return -1;
}// End of function

// Function to search a contact information based on phone number
// If found returns the found index position otherwise returns -`
int findPhoneNumber(ContactList cl[], int *len, char phone[])
{
// Loop variable
int c;

// Loops till number of records
for(c = 0; c < *len; c++)
{
// Checks if parameter phone number is equals to current record phone number
if(strcmp(phone, cl[c].PhoneNumber) == 0)
// Returns the found index position
return c;
}// End of for loop
// Returns -1 for not found
return -1;
}// End of function

// Function to search a contact information based on date of birth
// If found returns the found index position otherwise returns -`
int findBirthday(ContactList cl[], int *len, int month, int day, int year)
{
// Loop variable
int c;

// Loops till number of records
for(c = 0; c < *len; c++)
{
// Checks if parameter day, month and year is equals to current record day, month and year
if(month == cl[c].Birthday.month && day == cl[c].Birthday.day && year == cl[c].Birthday.year)
// Returns the found index position
return c;
}// End of for loop
// Returns -1 for not found
return -1;
}// End of function

// Function to delete a contact information based on first name
void deleteFirstName(ContactList cl[], int *len, char name[])
{
// Loop variable
int c;
// Calls the function to search name
int pos = findFirstName(cl, len, name);

// Checks if found position is not -1 record found
if(pos != -1)
{
// Loops from found index position to end of records
for(c = pos; c < *len; c++)
// Shift each record one position left
cl[c] = cl[c + 1];

// Decrease the record counter by one
*len = *len - 1;
// Displays success message
printf("\n Contact name %s deleted success fully.", name);
}// End of if condition
// Otherwise displays error message
else
printf("\n Unable to delete the name %s.", name);
}// End of function

// Function to delete a contact information based on phone number
void deletePhoneNumber(ContactList cl[], int *len, char phone[])
{
// Loop variable
int c;
// Calls the function to search phone
int pos = findPhoneNumber(cl, len, phone);

// Checks if found position is not -1 record found
if(pos != -1)
{
// Loops from found index position to end of records
for(c = pos; c < *len; c++)
// Shift each record one position left
cl[c] = cl[c + 1];

// Decrease the record counter by one
*len = *len - 1;
// Displays success message
printf("\n Contact phone number %s deleted success fully.", phone);
}// End of if condition
// Otherwise displays error message
else
printf("\n Unable to delete the phone number %s.", phone);
}// End of function

// Function to delete a contact information based on date of birth
void deleteBirthday(ContactList cl[], int *len, int month, int day, int year)
{
// Loop variable
int c;
// Calls the function to search birthday
int pos = findBirthday(cl, len, month, day, year);

// Checks if found position is not -1 record found
if(pos != -1)
{
// Loops from found index position to end of records
for(c = pos; c < *len; c++)
// Shift each record one position left
cl[c] = cl[c + 1];

// Decrease the record counter by one
*len = *len - 1;
// Displays success message
printf("\n Contact Birthday %d-%d-%d deleted success fully.", month, day, year);
}// End of if condition
// Otherwise displays error message
else
printf("\n Unable to delete the birthday %d-%d-%d.", month, day, year);
}// End of function

// Function to display all contact information
void printContactList(ContactList cl[], int len)
{
// Loop variable
int c;

printf("\n *********************** Contact Information *********************** ");

// Loops till number of records
for(c = 0; c < len; c++)
{
// Displays each record information
printf("\n\n First Name: %s \n Phone Number: %s", cl[c].FirstName, cl[c].PhoneNumber);
printf("\n Birth Day: %d-%d-%d", cl[c].Birthday.month, cl[c].Birthday.day, cl[c].Birthday.year);
}// End of for loop
}// End of function

// Function to return number of contact information
void showNumberOfContacts(int len)
{
printf("\n Number of contact records %d", len);
}// End of function

// Function to read the file contents and stores contact information
void readFile(ContactList cl[], int *len)
{
// Creates a file pointer to open the file ContactInfo.txt in read mode
FILE *rFile = fopen("ContactInfo.txt", "r");

// Re opens the file in read mode
// checks if file is unable to open for reading then display error message
// Stop the program
if (rFile == NULL)
{
printf("Error! opening file for reading.");
exit(1);
}// End of if condition

// Extracts data from file and count
while (!feof(rFile))
{
// Dynamically allocates memory for first name and phone number
cl[*len].FirstName = (char *) malloc(sizeof(char) * 20);
cl[*len].PhoneNumber = (char *) malloc(sizeof(char) * 20);

// Extracts first name from the file and stores at len index position
fscanf(rFile, "%s", cl[*len].FirstName);
// Extracts phone number from the file and stores at len index position
fscanf(rFile, "%s", cl[*len].PhoneNumber);
// Extracts month number from the file and stores at len index position
fscanf(rFile, "%d", &cl[*len].Birthday.month);
// Extracts day number from the file and stores at len index position
fscanf(rFile, "%d", &cl[*len].Birthday.day);
// Extracts year number from the file and stores at len index position
fscanf(rFile, "%d", &cl[*len].Birthday.year);

// Increase the counter by one
*len = *len + 1;
}// End of while loop
printf("\n File Read Successfully Done.");
}// End of function

// Function to write contact information to the file
void writeFile(ContactList cl[], int len)
{
// Loops variable
int c;
// Creates a file pointer to open the file ContactInfo.txt in write mode
FILE *wFile = fopen("ContactInfo.txt", "w");

// Re opens the file in write mode
// checks if file is unable to open for writing then display error message
// Stop the program
if (wFile == NULL)
{
printf("Error! opening file for writing.");
exit(1);
}// End of if condition

// Extracts data from file and count
for(c = 0; c < len; c++)
{
if(c == 0)
{
// Writes first name from the file and stores at len index position
fprintf(wFile, "%s\n", cl[c].FirstName);
// Writes phone number from the file and stores at len index position
fprintf(wFile, "%s\n", cl[c].PhoneNumber);
// Writes month number from the file and stores at len index position
fprintf(wFile, "%d\n", cl[c].Birthday.month);
// Writes day number from the file and stores at len index position
fprintf(wFile, "%d\n", cl[c].Birthday.day);
// Writes year number from the file and stores at len index position
fprintf(wFile, "%d\n", cl[c].Birthday.year);
}// End of if condition
// Otherwise not the first record
else
{
// Writes first name from the file and stores at len index position
fprintf(wFile, "\n%s", cl[c].FirstName);
// Writes phone number from the file and stores at len index position
fprintf(wFile, "\n%s", cl[c].PhoneNumber);
// Writes month number from the file and stores at len index position
fprintf(wFile, "\n%d", cl[c].Birthday.month);
// Writes day number from the file and stores at len index position
fprintf(wFile, "\n%d", cl[c].Birthday.day);
// Writes year number from the file and stores at len index position
fprintf(wFile, "\n%d", cl[c].Birthday.year);
}// End of else

}// End of while loop
printf("\n File Write Successfully Done.");
}// End of function

// Function to display menu, accept user choice and returns it
int menu()
{
int ch;
printf("\n\n *********************** MENU ***********************");
printf("\n 1) Add Contact Information.");
printf("\n 2) Search Contact Information by First Name.");
printf("\n 3) Search Contact Information by Phone Number.");
printf("\n 4) Search Contact Information by Birthday.");
printf("\n 5) Delete Contact Information by First Name.");
printf("\n 6) Delete Contact Information by Phone Number.");
printf("\n 7) Delete Contact Information by Birthday.");
printf("\n 8) Show Number Of Contact Information.");
printf("\n 9) Show All Contact Information.");
printf("\n 10) Save Contact Information.");
printf("\n 11) Read Contact Information.");
printf("\n 12) Exit.");
printf("\n What is your choice? ");
scanf("%d", &ch);
return ch;
}// End of function

--------------------------------------------------------------------------

#include "ContactList.c"

// main function definition
int main()
{
// Creates an array of objects of class ContactList
ContactList contacts[MAX];
// To store number of records
int len = 0;
// To store position return by the function
int pos;
// To store name entered by the user
char name[20];
// To store phone entered by the user
char phone[20];
// To store the month, day and year entered by the user
int month, day, year;

// Loops till user choice is not 12
do
{
// Calls the function to accept user choice and calls appropriate function based on user choice
switch(menu())
{
case 1:
// Calls the function to accept contact information from the user
acceptContact(contacts, &len);
break;
case 2:
// Accepts the name from the user
printf("\n Enter the name to search: ");
scanf("%s", name);

// Calls the function to search name and stores the returns found index position
pos = findFirstName(contacts, &len, name);

// Checks if found position is not -1 record found
if(pos != -1)
{
// Displays each record information
printf("\n\n First Name: %s \n Phone Number: %s", contacts[pos].FirstName,
contacts[pos].PhoneNumber);
printf("\n Birth Day: %d-%d-%d", contacts[pos].Birthday.month,
contacts[pos].Birthday.day, contacts[pos].Birthday.year);
}// End of if condition

// Otherwise record not found display error message
else
printf("\n No record found on name: %s", name);
break;
case 3:
// Accepts the phone from the user
printf("\n Enter the phone number to search: ");
scanf("%s", phone);
// Calls the function to search phone number and stores the returns found index position
pos = findPhoneNumber(contacts, &len, phone);

// Checks if found position is not -1 record found
if(pos != -1)
{
// Displays each record information
printf("\n\n First Name: %s \n Phone Number: %s", contacts[pos].FirstName,
contacts[pos].PhoneNumber);
printf("\n Birth Day: %d-%d-%d", contacts[pos].Birthday.month,
contacts[pos].Birthday.day, contacts[pos].Birthday.year);
}// End of if condition

// Otherwise record not found display error message
else
printf("\n No record found on contact number: %s", phone);
break;
case 4:
// Accepts the birthday from the user
printf("\n Enter the Birthday to search: ");
printf("\n Enter the month: ");
scanf("%d", &month);
printf("\n Enter the day: ");
scanf("%d", &day);
printf("\n Enter the year: ");
scanf("%d", &year);

// Calls the function to search birthday and stores the returns found index position
pos = findBirthday(contacts, &len, month, day, year);

// Checks if found position is not -1 record found
if(pos != -1)
{
// Displays each record information
printf("\n\n First Name: %s \n Phone Number: %s", contacts[pos].FirstName,
contacts[pos].PhoneNumber);
printf("\n Birth Day: %d-%d-%d", contacts[pos].Birthday.month,
contacts[pos].Birthday.day, contacts[pos].Birthday.year);
}// End of if condition

// Otherwise record not found display error message
else
printf("\n No record found on Birthday: %d-%d-%d", month, day, year);
break;
case 5:
// Accepts the name from the user
printf("\n Enter the name to search: ");
scanf("%s", name);
// Calls the function to delete record
deleteFirstName(contacts, &len, name);
break;
case 6:
// Accepts the phone number from the user
printf("\n Enter the phone number to search: ");
scanf("%s", phone);
// Calls the function to delete record
deletePhoneNumber(contacts, &len, phone);
break;
case 7:
// Accepts the birthday from the user
printf("\n Enter the Birthday to delete: ");
printf("\n Enter the month: ");
scanf("%d", &month);
printf("\n Enter the day: ");
scanf("%d", &day);
printf("\n Enter the year: ");
scanf("%d", &year);
// Calls the function to delete record
deleteBirthday(contacts, &len, month, day, year);
break;
case 8:
showNumberOfContacts(len);
break;
case 9:
printContactList(contacts, len);
break;
case 10:
writeFile(contacts, len);
break;
case 11:
readFile(contacts, &len);
break;
case 12:
exit(0);
default:
printf("\n Invalid Choice........");
}// End of switch - case
}while(1);// End of do - while loop
return 0;
}// End of main function

Sample Output:

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 11

File Read Successfully Done.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9

*********************** Contact Information ***********************

First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001

First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011

First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014

First Name: Suresh
Phone Number: 9822654112
Birth Day: 6-12-2015

First Name: Binod
Phone Number: 8845655987
Birth Day: 9-25-2019

First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 1

Enter First Name: Rahul

Enter Phone Number: 1122334455

Enter Date Of Birth:
Enter Month: 1

Enter Day: 1

Enter Year: 2000


*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9

*********************** Contact Information ***********************

First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001

First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011

First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014

First Name: Suresh
Phone Number: 9822654112
Birth Day: 6-12-2015

First Name: Binod
Phone Number: 8845655987
Birth Day: 9-25-2019

First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998

First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 2

Enter the name to search: Dinku

No record found on name: Dinku

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 2

Enter the name to search: Pyari


First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 3

Enter the phone number to search: 1212

No record found on contact number: 1212

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 3

Enter the phone number to search: 1122334455


First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 4

Enter the Birthday to search:
Enter the month: 12

Enter the day: 2

Enter the year: 2000

No record found on Birthday: 12-2-2000

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 5

Enter the name to search: 14

Unable to delete the name 14.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 4

Enter the Birthday to search:
Enter the month: 5

Enter the day: 14

Enter the year: 2011


First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 5

Enter the name to search: Sunil

Unable to delete the name Sunil.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 5

Enter the name to search: Binod

Contact name Binod deleted success fully.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9

*********************** Contact Information ***********************

First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001

First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011

First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014

First Name: Suresh
Phone Number: 9822654112
Birth Day: 6-12-2015

First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998

First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 6

Enter the phone number to search: 3322

Unable to delete the phone number 3322.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 6

Enter the phone number to search: 9822654112

Contact phone number 9822654112 deleted success fully.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9

*********************** Contact Information ***********************

First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001

First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011

First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014

First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998

First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 7

Enter the Birthday to delete:
Enter the month: 1

Enter the day: 12

Enter the year: 1999

Unable to delete the birthday 1-12-1999.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 7

Enter the Birthday to delete:
Enter the month: 9

Enter the day: 19

Enter the year: 20014

Unable to delete the birthday 9-19-20014.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9

*********************** Contact Information ***********************

First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001

First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011

First Name: Amit
Phone Number: 7822456789
Birth Day: 9-19-2014

First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998

First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 7

Enter the Birthday to delete:
Enter the month: 9

Enter the day: 19

Enter the year: 2014

Contact Birthday 9-19-2014 deleted success fully.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 9

*********************** Contact Information ***********************

First Name: Pyari
Phone Number: 9040114545
Birth Day: 8-18-2001

First Name: Mohan
Phone Number: 8942214333
Birth Day: 5-14-2011

First Name: Sunita
Phone Number: 7788456523
Birth Day: 1-22-1998

First Name: Rahul
Phone Number: 1122334455
Birth Day: 1-1-2000

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 8

Number of contact records 4

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 10

File Write Successfully Done.

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 19

Invalid Choice........

*********************** MENU ***********************
1) Add Contact Information.
2) Search Contact Information by First Name.
3) Search Contact Information by Phone Number.
4) Search Contact Information by Birthday.
5) Delete Contact Information by First Name.
6) Delete Contact Information by Phone Number.
7) Delete Contact Information by Birthday.
8) Show Number Of Contact Information.
9) Show All Contact Information.
10) Save Contact Information.
11) Read Contact Information.
12) Exit.
What is your choice? 12

ContactInfo.txt file contents

Pyari 9040114545 8 18 2001
Mohan 8942214333 5 14 2011
Amit 7822456789 9 19 2014
Suresh 9822654112 6 12 2015
Binod 8845655987 9 25 2019
Sunita 7788456523 1 22 1998


Related Solutions

MUST BE DONE IN C (NOT C++) Your create a program that can implement the cases...
MUST BE DONE IN C (NOT C++) Your create a program that can implement the cases in which the initial unit is Fahrenheit or something not recognizable. Your program should incorporate Fahrenheit to Celsius, Fahrenheit to Kelvin and unknown initial units (display an error message for this last one). You must use functions to calculate Fahrenheit degrees.
C++ program using Eclipse IDE The C++ program should have concurrency. The C++ program should create...
C++ program using Eclipse IDE The C++ program should have concurrency. The C++ program should create 2 threads that will act as counters. One thread should count down from 5 to 0. Once that thread reaches 0, then a second thread should be used to count up to 20.
Consider the following C++ program that makes use of many features that are unique to C++...
Consider the following C++ program that makes use of many features that are unique to C++ and did not exist in C. #include <iostream> #include <string> #include <cstdint> #include <vector> using namespace std; enum LetterGrade { A = 4, B = 3, C = 2, D = 1, F = 0 }; // type T must be castable into a double template<class T> double getArrayAverage(vector<T>& vec) { double sum = 0; for (const auto& value : vec) { sum +=...
Create a C structure which stores information about a book. Each book should have the following...
Create a C structure which stores information about a book. Each book should have the following data: Author (string), Title (string), Publisher (string), Year (int), ISBN (int), Genre (string), Price (float). Write a C program which creates an array of 100 of these structures, then prompts the user to enter book information to fill the array. The data entry should stop when the array is full, or when the user enters 0 for the ISBN.
Create a program with the features: NEEDED IN C++. Keywords: has object, passing object 1) Implement...
Create a program with the features: NEEDED IN C++. Keywords: has object, passing object 1) Implement a classnamed StarWars; Class StarWarshas a classnamed World; 2) The object starWarsOBJcreated the Class Moonas a tool that Darth Vader uses to control the Class World; Therefore, having the object worldOBJwithin your starWarsOBJ, pass the object moonOBJ as an argument to the worldOBJ; 3) The moonOBJhas a huge tower that is represented as the struct data_tower towercomprised of: int total_antennas,float *sending_signal, string message. 4)...
C++ Write a program to create a linked list which stores the details of employees(Employee number,...
C++ Write a program to create a linked list which stores the details of employees(Employee number, employee name, rate, hours worked). Create a menu to manage the emoployee data. MENU 1. ADD EMPLOYEE DETAILS 2. DELETE EMPLOYEE 3. SEARCH EMPLOYEE 4. PRINT EMPLOYEE PAYROLL 5. EXIT When the user selected option #4 the program should print the following pay report for each employee: EmpNo.     Name      Rate    Hours    Regular Pay      Overtime Pay     Gross Pay Any hours worked above 40 hours are...
C++ Programming Create a C++ program program that exhibits polymorphism. This file will have three class...
C++ Programming Create a C++ program program that exhibits polymorphism. This file will have three class definitions, one base class and three derived classes. The derived classes will have an inheritance relationship (the “is a” relationship) with the base class. You will use base and derived classes. The base class will have at least one constructor, functions as necessary, and at least one data field. At least one function will be made virtual. Class members will be declared public and...
Create a C # program that calculates what a worker must be paid if each day...
Create a C # program that calculates what a worker must be paid if each day I work different hours during the week. The price per hour is 80.0.
Create the logic for a program that stores 5 names in an array. Your program will...
Create the logic for a program that stores 5 names in an array. Your program will then ask the user which name (s)he wants to search. The program receives the name to be searched as input and searches the array for the name entered. If the name is one of the names in the array, display the message "Name found.". Otherwise, display the message "Name not found.". in pseudocode please in python
********************C# C# C#******************** Part A: Create a project with a Program class and write the following...
********************C# C# C#******************** Part A: Create a project with a Program class and write the following two methods(headers provided) as described below: 1. A Method, public static int InputValue(int min, int max), to input an integer number that is between (inclusive) the range of a lower bound and an upper bound. The method should accept the lower bound and the upper bound as two parameters and allow users to re-enter the number if the number is not in the range...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT