First, make a datafile containing at least 10 people's names and zip codes. Have at least one zip code that won't appear in the next file. It could look like this:

Sue Green 45667
Joe Gradier 47888
Betty Purple 65471
etc..

Now make another datafile containing zip codes and city/states. It could look like this:

45667 Muncie IN
98741 Nowhere CA
etc..

Note: a datafile is NOT the same thing as an access database! A datafile is a text file that you can open and read/write data to.

Write a program with the following attributes:

A main form, with these attributes:

  • A text box for first name and a text box for last name that the user can enter data into. Text boxes to contain the city and state and zip code info you'll look up (the user can not enter anything in these boxes)
  • Appropriately label each textbox, and put "Address Lookup" header on the form.
  • Put a button on the form that says "Find".
  • When the user clicks the "Find" button:
    • Look up the first/last names in the appropriate datafile to get the zip code. If the person does not exist, throw an error and put an appropriate message on the form
    • If the user exists, get the zip code and close the file Use that zip code to go to the other datafile and find the person's city and state
    • If that zip code doesn't exist, throw an error and put the appropriate message on the form
    • If everything works right, put the zip code, city and state in the appropriate textboxes
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.