Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions You will create code to store information on a customer including: The customer s first and last name, The customer street address, The customer

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: 25 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago