Question
Instructions You will create code to store information on a customer including: The customers first and last name, The customer street address, The customer city,
Instructions You will create code to store information on a customer including: The customers first and last name, The customer street address, The customer city, The customer province, The customer postal code. You should: Create a structure to store the information on the customer, Create a function to prompt the user to enter the customer information on the command line and store it in the structure. This function will ensure that every field has a value and that the postal code is valid. If any are not valid, it will prompt the user until a valid value is entered. This function will return a structure that is guaranteed to have values in each field and have a valid postal code. Create a function to test the validity of the postal code and return a Boolean true if the code is valid and a Boolean false if the code is invalid. It should accept postal code in upper or lower case and translate them all to upper case. It should also accept them with no spaces or several spaces between the groups of 3 characters. It will return the postal code in uppercase with one space between the groups of 3 characters. Create a main that invokes the function to get the data into the structure and then prints out the contents of the structure. NOTE that the function fgets() used with the stdin stream will read a string until end of line and add a at the end of the string. This will reliably determine if an empty string was entered. A typical use of the function to read customer data is: Enter your first name: John
Enter your last name: Invalid Entry:
Enter your last name: Smith
Enter your street address: 35 Elm St.
Enter your city: Toronto
Enter your province: ON
Enter your postal code:m2e44x
Invalid Entry: Enter your postal code: m2e 4x4 You entered: John Smith 35 Elm St., Toronto, ON, M2E 4X4
Once you complete the two (or more) functions and the main program, you should create a test project in the same Visual Studio solution. Then design and build unit tests for the two functions you created. You should include both black box and white box unit tests. Comment each test so that the instructor knows what you are testing. Be sure to use appropriate test data.
Reflections should consider the questions in depth and not be trivial. Some reflections might require research to properly answer the question. As a rough guideline, the answer to each reflection questions should be about 100 words in length.
How did you test the function to gather customer information to ensure that blank lines were not entered? Testing that the correct prompts were issued for blank lines is beyond the scope of this workshop, however how could you test that the correct prompts were produced by the program if you had to?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started