CS 153 Data Structures I
Programming Assignment #2
Due: 8/30/01
This programming assignment is designed to:
-
review the use of Edit Boxes
-
review the use of Buttons
-
review the use of CStrings
-
review/use char arrays
-
review/use char array functions
Create a VC++ GUI that contains the following edit boxes
- Complete telephone number (type is CString)
- 1st 3 digits - area code (type is int)
- 2nd 3digits - prefix (type is int)
- 3rd 4 digits - number proper (type is int)
- last 3 digits - extension (type is int)
and the following buttons
- 'Concatenate' from individual numbers to Full CString
- '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
- examined for == 0. Ignore if zero
- integers should be converted to ASCII
- the ASCIIs should be concatenated to form a complete phone number
- 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
- determine if there is an area code present, if yes convert it to int and
store in the area code int
- determine if there is a prefix present, if yes convert it to int and store
in the prefix int
- determine if there is a number proper present, if yes convert it to int
and store in the number proper int
- 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:
- x789
- 4567
- 341-4496
- 341-4496x789
- (573)341-4496
- (573-341-4496x789
- 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 |