+1(805) 568 7317

input input will be a file and user requests the file contains zip code ranges and s 5188308


Input will be a file and user requests. The file contains Zip code ranges and state names. The four data elements in each record are (a) the full state name, (b) the state postal code (e.g. 'CA' for California), (c) the low Zip code for a state, and (d) the high Zip code for a state. The data file is available at this link. You should name it ZipRange.txt and store it in the C:Temp directory.

The user input will comprise requests and transaction data. The requests will be a transaction processing code (the values 1, 2, and 3) and related data (either Zip codes or state codes).

You may assume that there are 70 or fewer records in the input Zip code file. Sample Records From the Zip code file:

Alaska AK 99501 99950 Alabama AL 35004 36925 Arkansas AR 71601 72959 Arizona AZ 85001 86556 California CA 90001 96162 Colorado CO 80001 81658


1.Read in the ZipRange.txt file. Store each entry in an array of structs. Check to be sure that the number of records in the file does not exceed the array size. Write out error message 1 listed below if the number of records exceeds the array size.

2.When all records have been read in, validate the file data. Verify that no Zip code ranges overlap any other state's Zip code ranges. If they do, write out error message 2 listed below and do not do any further processing. Identify the highest and lowest Zip codes in the table.

3.Write out the number of records read, and the low and high Zip codes, using message 3 listed below.

4.Display message 4 listed below and read in the user's processing code.

5.Validate that the processing code is 1, 2, or 3. If not, display error message 5 listed below and continue with step 4 until a valid code is entered.

6.If the processing code is 1, issue user prompt message 10 and read in a two-character state code. Search the table for that state code and display message 6. If the state code is not found, display error message 7.

7.If the processing code is 2, issue user prompt message 11 and read in a Zip code. Search the table for an entry whose low Zip code range is not greater than the user-supplied Zip code, and whose high Zip code is not less than the user-supplied Zip code. Display message 8 when found. If no entry is found, display error message 9.

8.If the processing code is 3, end execution. If not, continue with step 4.

Use the following messages for output:

Error message 1:
Too many Zip code range records – maximum is nn
Replace nn with the maximum limit the program will allow. (You define this.)

Error message 2:
Zip code range aaaaa through bbbbb in state cc overlaps Zip code range xxxxx through yyyyy in state zz
Replace aaaaa and bbbbb with the low and high Zip codes in the overlapping state, and replace cc with the overlapping state code. Replace xxxxx and yyyyy with the low and high Zip codes in overlapped state, and replace zz with the overlapped state code.

Message 3:
nnnnn Zip Code records read, ranging from xxxxx through yyyyy
Replace nnnnn with the number of Zip code records from the ZipRange.txt file, and replace xxxxx and yyyyy with the low and high Zip codes read in from the file.

Message 4:
Enter 1 to get the Zip code range for a state, 2 to get the state name for a Zip code, or 3 to end

Message 5:
Response must be 1, 2, or 3 – please try again

Message 6:
Zip code range for xx is yyyyy through zzzzz
Replace xx with the state name, and replace yyyyy and zzzzz with the low and high Zip codes respectively.

Error message 7:
State code xx was not found in the table
Replace xx with the two-character state code entered by the user.

Message 8:
Zip code xxxxx is in yy
Replace xxxxx with the Zip code entered by the user, and replace yy with the state name.

Error message 9:
Zip code xxxxx was not found in any state
Replace xxxxx with the Zip code entered by the user.

User Prompt message 10
Enter a two-character state code.

>User Prompt message 11
Enter a Zip code

Language : c++

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon

Order Now