Mini-Program 1: Data Manipulation

Description

Custom-built programs are often used to manipulate a dataset by reformatting or performing additional calculations on data that might not be easily done using standard applications. For example, a researcher may wish to modify a structured dataset by performing a set of operations on each line of the data file.

SPECIFICATIONS

Four functions are to be developed, findLocation, findMinimumTemp, findMaximumTemp, and findCurrentTemp. These functions are to receive as input a line of text and return the location, minimum temp, maximum temp, and current temp. Your program must handle missing values successfully.

INPUT

These functions will receive a string as input. Include the results from your methods for each of the eight input lines. You can determine the results by copying and pasting the line from here into the main method.

Location Recent Jan Feb Mar

Kiptopeke-VA 80 36 39 46

Lewisetta-VA 79 N/A N/A N/A

Virginia-Beach-VA 73 N/A N/A N/A

Cape-Hatteras-NC 76 49 46 52

Myrtle-Beach-SC 81 48 50 55

Daytona-Beach-FL 80 61 59 65

Miami-Beach-FL 86 71 73 75

Savannah-Beach-GA 84 51 52 59

OUTPUT

Each function will return an appropriate value (location or temperature).

DELIVERABLES

Turn in a hard copy of the four functions that return the appropriate value. Also include the output line for each of the eight input lines. Note: you are not to read anything from the keyboard or file.

GETTING STARTED

//include io and string libraries and use namespace std here.

string findLocation(string input)

{

string location;

//Process the input and return the location

//location = ;

return location;

}

int findMinimumTemp(string input)

{

int temp;

//Process the input and return the minimum of the four temperatures

// convert strings to integers with the following command: some_int = atoi( some_string.c_str() );

//Note: you will have to repeat the process of comparing tokens several times.

//temp = ;

return temp;

}

int findMaximumTemp(string input)

{

int temp;

//Process the input and return the maximum of the four temperatures

// convert strings to integers with the following command: some_int = atoi( some_string.c_str() );

//Note: you will have to repeat the process of comparing tokens several times.

//temp = ;

return temp;

}

int findCurrentTemp(string input)

{

int temp;

//Process the input and return the current temperature

// convert strings to integers with the following command: some_int = atoi( some_string.c_str() );

//temp = ;

return temp;

}

int main()

{

string input = "PASTE_INPUT_LINE_HERE";

cout << findLocation(input) << ": " << findMinimumTemp (input) << " minimum, " <<

findMaximumTemp (input) << " maximum, " << findCurrentTemp (input) << " current" << endl ;

return 0;

}