Contact management system

Assignment Help C/C++ Programming
Reference no: EM132400040

Contacts - Assignment

Assignment 2 uses assignment 1 and focuses on a "Contact Management System". This assignment continues to emphasize modularization by compartmentalizing highly cohesive and tightly coupled tasks into modules (*.h and *.c files). This strategy will reduce redundant coding throughout all parts of the application.

Milestone 1

Open the project file A2MS1 and look inside (expand "Header Files" and "Source Files" folders - see figure 2.1.1(attached)).

Contacts Header File (.h)

Structures
Open the contacts.h file and copy the structures (Name, Address, Numbers, and Contact) from the file contacts.h in Assignment 1. Be careful not to paste over the helpful comments in the provided contacts.h file!

Function Prototypes
1. Copy the function prototypes (getName, getAddress, and getNumbers) from the file contacts.h in Assignment 1 (Milestone 4). Again, be careful not to paste over the helpful comments in the provided contacts.h file!

2. Declare an additional function prototype:
void getContact(struct Contact *contact);
• This function has one parameter that receives a pointer to a Contact.
• The details on how this function should work is described in Milestone 2.

Contacts Source File (.c)

Open the contacts.c source code file.
Libraries
In order to define the functions that were declared as prototypes in the contacts.h file, this source file needs visibility of their existence. This is accomplished by including the required header library file. Include the contacts.h header file (see source code comments).

Function Definitions
1. Copy the function definitions (getName, getAddress, and getNumbers) from the file contacts.c
in Assignment 1 (Milestone 4).

2. Add an empty definition for the new function getContact (see the prototype declared in the contacts.h file) - refer to the source comments for placement. For this milestone you don't have to define the details for this function (this will be done in Milestone 2) so for now, specify an empty code block:
getContact function header goes here...
{
// Use an open and close curly brace with a blank line
}

Contact Helper Header File (.h)

The contact helper module contains a group of common functions for use in other source code modules in the application. Other modules will be able to access these functions (without having to recode them) by including this header file.

Function Prototypes
Open the contactHelpers.h file. To help you get started, you will notice the prototype for the clearKeyboard function is already done for you.

void clearKeyboard(void);
• clearKeyboard does not return a value and has no parameters.
• The details on how this function should work is described in Milestone 2.

Add the following additional helper function prototypes:

void pause(void);
• pause does not return a value and has no parameters.
• The details on how this function should work is described in Milestone 2.

int getInt(void);
• getInt returns an integer value and has no parameters.
• The details on how this function should work is described in Milestone 2.

int getIntInRange(int min, int max);
• getIntInRange returns an integer value and receives two (2) integer parameters.
• The details on how this function should work is described in Milestone 2.

int yes(void);
• yes returns an integer value and has no parameters.
• The details on how this function should work is described in Milestone 2.

int menu(void);
• menu returns an integer value and has no parameters.
• The details on how this function should work is described in Milestone 2.

void contactManagerSystem(void);
• contactManagerSystem does not return a value and has no parameters.
• The details on how this function should work is described in Milestone 2.

Contact Helper Source File (.c)

Open the contactHelpers.c source code file.
Libraries
Just as the contacts.c source code file included the contacts.h header file, the contactHelpers.c source code file should include the contactHelpers.h header file. Including the header file exposes the prototyped functions before they are defined (see source code comments).

Function Definitions
Add an empty definition for each function prototyped in the contactHelpers.h. You will notice the clearKeyboard function has been done for you. Follow this example for the remaining functions (refer to the source code comments for placement).

Milestone 2

Open the project file A2MS2 and look inside (expand "Header Files" and "Source Files" folders - see figure 2.2.1). You will notice an additional source code file a2ms2.c (do not modify this file). This is the main file used to assess your functions to determine if they work to this milestone's specifications.

Header Files

contact.h and contactHelpers.h
There are no changes required to these files for this milestone. Consult the comments provided in the header files (.h) for these modules and copy the appropriate contents from Milestone 1.

Contact Helper Source File (.c)

1. Open the contactHelpers.c source code file.
Reminder: Be sure to include the contactHelpers.h header file!
To help you get started, notice that the clearKeyboard function is done for you.
2. For the remaining functions, copy the empty functions from the contactHelpers.c file in Milestone 1 (consult the source code comments for placement - be careful not to replace the clearKeyboard function that is already provided for you).

3. Complete the full function definition for each function using the descriptions below:

void clearKeyboard(void);
• clearKeyboard does not return a value and has no parameters.
• This function makes sure the keyboard input buffer is clear of any residual character by reading from the input buffer character by character until it reads a new line character.
• This function is provided for you - please consult the IPC144 course notes in the section "Input Functions" to learn about the standard input output library (stdio) getchar() function.

void pause(void);
• pause does not return a value and has no parameters.
• This function pauses the execution of the application by displaying a message and waiting for the user to press the <ENTER> key.
• Display the following line and DO NOT include a newline character:

>(Press Enter to continue)<

• After displaying the above message, call the clearKeyboard function.

Note: The clearKeyboard function is used for a foolproof <ENTER> key entry

int getInt(void);
• getInt returns an integer value and has no parameters.
• This function gets a valid integer from the keyboard and returns it. If the value entered is not a valid integer an error message should be displayed:
>*** INVALID INTEGER *** <Please enter an integer>: <

• This function should continue to prompt the user for a valid integer.
• This function must be foolproof and guarantee an integer value is entered and returned.

int getIntInRange(int min, int max);
• getIntInRange returns an integer value and receives two (2) integer parameters.
• This function uses getInt to receive a valid integer and returns it only if the value entered is within the lower-bound (first parameter) and upper-bound (second parameter) range (inclusive).
• If the integer entered is not within the valid range, the following error message should be displayed:
>*** OUT OF RANGE *** <Enter a number between [param-1] and [param-2]>: <

Note: Substitute the "[param-1]" and "[param-2]" with the function parameter values

• This function should be a foolproof call to ensure an integer is entered within a given range. Therefore, it should continue to prompt the user for an entry until a valid integer is within the specified range.

int yes(void);
• yes returns an integer value and has no parameters.
• This function prompts the user for a single character entry
• The character entered is only valid if it is a "Y", "y", "N", or "n". Any other value entered (including more than one character) is an error and should display the following message:
>*** INVALID ENTRY *** <Only (Y)es or (N)o are acceptable>: <

int menu(void);
• menu returns an integer value and has no parameters.
• This function should display the following menu:

>Contact Management System<
>-------------------------< (there are 25 dashes)
>1. Display contacts<
>2. Add a contact<
>3. Update a contact<
>4. Delete a contact<
>5. Search contacts by cell phone number<
>6. Sort contacts by cell phone number<
>0. Exit<
><
>Select an option:> <

• Prompt for user entry an integer value between the values 0-6 inclusive
• Any other value entered or an integer that is not within the 0-6 range is an error
• The function should continue to prompt for an integer value within the 0-6 range until a valid value is entered.
• When a valid integer value is entered, this value is returned.

void contactManagerSystem(void);
• contactManagerSystem does not return a value and has no parameters.
• This function is the heart of the application and will run the whole program.
• This function starts by showing the menu for the system and receives the user's
selection
• If the user enters 1, it displays:
><<< Feature 1 is unavailable >>>< (followed by two (2) newlines)
If the user enters 2, it displays:
><<< Feature 2 is unavailable >>>< (followed by two (2) newlines)
If the user enters 3, it displays:
><<< Feature 3 is unavailable >>>< (followed by two (2) newlines)
If the user enters 4, it displays:
><<< Feature 4 is unavailable >>>< (followed by two (2) newlines)
If the user enters 5, it displays:
><<< Feature 5 is unavailable >>>< (followed by two (2) newlines)
If the user enters 6, it displays:
><<< Feature 6 is unavailable >>>< (followed by two (2) newlines)
For selections between 1 and 6, the application should pause and then return to displaying the menu.
• If the user enters 0, prompt to exit the application. Display the following:
>Exit the program? (Y)es/(N)o: <

Wait for the user to enter "Y", "y", "N" or "n" (for Yes or No).
If the user replies Yes ("Y","y"), it will end the program displaying the following message:

>Contact Management System: terminated< (followed by a newline)

Otherwise, if the user entered No ("N","n"), the application continues to display the menu.
• The following is a general pseudo code for a menu driven user interface. Using this pseudo code is optional. You can use any other logic if you like.

Menu driver pseudo code: while it is not done
display menu
get selected option from user check selection:
option one selected act accordingly
end option one option two selected
act accordingly end option two
.
.
Exit is selected program is done
end exit end check
end while

Contacts Source File (.c)

Open the contacts.c source code file.
1. Open the contacts.c source code file.
Reminder: Be sure to include the contacts.h header file!
The contact helpers module contains additional functions that can be used to streamline some functions previously coded for getting the Name, Address, and Numbers parts of a Contact. To make these helper functions available for use in this source file include the contactHelpers.h header file (see the source code comments for placement).
2. Copy the functions from the contacts.c file in Milestone 1 (see the source code comments for placement - be careful not to replace any additional helpful comments)

3. Update the functions getName, getAddress, and getNumbers to use any of the new functions created in the contactHelpers.h library (wherever applicable). See source code comments for some suggestions.

4. Update function getNumbers so that the cell phone number entry is mandatory (don't ask if
the user wants to enter this value)

5. Define the new function prototyped in Milestone 1 getContact using the following description:
void getContact(struct Contact *contact);
• This function does not return a value but has one parameter that receives a pointer to a Contact.
• The purpose of this function is to set the values for a Contact using the pointer parameter variable (set the Contact it points to).
• Use the pointer parameter received to this function to supply the appropriate Contact member to the "get" functions (getName, getAddress, and getNumbers) to set the values for the Contact.

Milestone 3

Open the project file A2MS3 and look inside (expand "Header Files" and "Source Files" folders).

This milestone introduces the remaining function prototypes required to complete the contacts management system. You have three tasks to perform for this milestone:

1. Declare new function prototypes in contactHelpers.h
2. Define the new functions with empty code blocks in contactHelpers.c
3. Update contacts.h with safeguard and contact.c to use new function getTenDigitPhone

Contact Helper Header File (.h)

Open the contactHelpers.h file. Refer to the comments in the file and copy/paste your code from MS2 where directed.
You will need to include the contacts.h header file so the new functions (parameters) will be able to use the structures defined in that module (see source comments for placement).

Function Prototypes
You will notice there are two (2) prototypes already prepared:
void getTenDigitPhone(char phoneNum[]);
• getTenDigitPhone does not return a value and expects a character array sized for 10 characters plus the null terminator.
• The next section describing the contactHelpers.c source file explains this function and its use.
int findContactIndex(const struct Contact contacts[], int size,
const char cellNum[]);
• findContactIndex returns an integer and expects a Contact array (marked constant so
changes can't be made to it), an integer, and a character array.
• The details on how this function should work is described in Milestone 4. Add the following additional function prototypes:
void displayContactHeader(void);
• displayContactHeader does not return a value and has no parameters.
• The details on how this function should work is described in Milestone 4.
void displayContactFooter(int count);
• displayContactFooter does not return a value and receives one integer parameter.
• The details on how this function should work is described in Milestone 4.
void displayContact(const struct Contact *contact);
• displayContact does not return a value and receives a constant Contact pointer (cannot be updated) parameter.
• The details on how this function should work is described in Milestone 4.
void displayContacts(const struct Contact contacts[], int size);
• displayContacts does not return a value and receives a constant Contact array (cannot be updated), and an integer for parameters.
• The details on how this function should work is described in Milestone 4.
void searchContacts(const struct Contact contacts[], int size);
• searchContacts does not return a value and receives a constant Contact array (cannot be updated), and an integer for parameters.
• The details on how this function should work is described in Milestone 4.
void addContact(struct Contact contacts[], int size);
• addContact does not return a value and receives a Contact array, and an integer for parameters.

• The details on how this function should work is described in Milestone 4.
void updateContact(struct Contact contacts[], int size);
• updateContact does not return a value and receives a Contact array, and an integer for parameters.
• The details on how this function should work is described in Milestone 4.
void deleteContact(struct Contact contacts[], int size);
• deleteContact does not return a value and receives a Contact array, and an integer for parameters.
• The details on how this function should work is described in Milestone 4.
void sortContacts(struct Contact contacts[], int size);
• sortContacts does not return a value and receives a Contact array, and an integer for parameters.
• The details on how this function should work is described in Milestone 4.

Milestone 4

Open the project file A2MS4 and look inside (expand "Header Files" and "Source Files" folders - see figure 2.4.1). Do not modify the source code file: a2ms4.c. This is the main file used to assess your functions to determine if they work to this milestone's specifications.

Attachment:- Contacts Assignment.rar

Reference no: EM132400040

Questions Cloud

Role of the media in the dissemination of the press release : Explain the speed or timing of the release and dissemination of the press release and Describe key interest groups and their agendas in relation to the press.
Submit a business intelligence solution framework : In this assignment, you will submit a business intelligence solution framework for a university with one online and two physical campuses
Indirect approach informing your sales team of the news : Write a negative news message in a direct or indirect approach informing your sales team of the news.
Economies of scale-economies of scope-global companies : Economies of scale, economies of scope, global companies, global teams, globalization strategy, international division, joint venture,
Contact management system : Declare new function prototypes and Define the new functions with empty code blocks - Update contacts.h with safeguard and contact.c to use new function
FI 4090 Introduction to Financial Data Analytics Assignment : FI 4090 Introduction to Financial Data Analytics Assignment - Logistic Regression, Homework Help, Georgia State University, USA. Analyze data in CreditCard
Develop logical cause-and-effect diagram for the problem : Develop a logical cause-and-effect diagram for the problem "inaccurate shipment."
Discuss how it incorporates aida strategy : Discuss how it incorporates AIDA strategy and what methods it uses to meet each of the parts of the AIDA strategy.
Appearances control massive segments of different markets : In today's economy, there are a wide number of powerful companies who in all appearances control massive segments of different markets.

Reviews

len2400040

11/11/2019 10:01:53 PM

This assignment continues to emphasize modularization by compartmentalizing highly cohesive and tightly coupled tasks into modules. I already got my Assignment 1 from you guys and this Assingment2 it will be based on Assingment 1 I post Documantation sof it i need it in 3 days

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd