CS 153 Data Structures I
Programming Assignment #2

Due: 8/30/01

This programming assignment is designed to:

Create a VC++ GUI that contains the following edit boxes
  1. Complete telephone number (type is CString)
  2. 1st 3 digits - area code (type is int)
  3. 2nd 3digits - prefix (type is int)
  4. 3rd 4 digits - number proper (type is int)
  5. last 3 digits - extension (type is int)


and the following buttons

  1. 'Concatenate' from individual numbers to Full CString
  2. 'Parse' from Full phone number to individual numbers


When Button Concatenate is clicked the contents of 1st, 2nd, 3rd and 4th int boxes should be

  1. examined for == 0. Ignore if zero
  2. integers should be converted to ASCII
  3. the ASCIIs should be concatenated to form a complete phone number
  4. stored in the COMPLETE CString


When Button Parse is clicked the contents of COMPLETE phone number should be parsed into 1st, 2nd, 3rd and 4th by

  1. determine if there is an area code present, if yes convert it to int and store in the area code int
  2. determine if there is a prefix present, if yes convert it to int and store in the prefix int
  3. determine if there is a number proper present, if yes convert it to int and store in the number proper int
  4. determine if there is an extension present, if yes convert it to int and store in the extension int

Legal values of COMPLETE phone number should include:

  1. x789
  2. 4567
  3. 341-4496
  4. 341-4496x789
  5. (573)341-4496
  6. (573-341-4496x789
  7. any '-' or '(' or ')' may be replaced by a blank

Legal combinations of non-zero individual int Edit Boxes should include:

If you find
Generate in the COMPLETE box
box 4 only (extension box) x789
box 3 only (proper number) 4567
boxes 2 and 3 (with or without 4) 341-4496
boxes 1, 2 and 3 (with or without 4) (573)341-4496