Skip to main content

Hands-On Exercise 5

For this exercise, you'll create a new ObjectScript.Lookup1 class. This class will eventually allow lookups by name, phone, or date of birth. The instructions below contain suggested names and basic specifications for the methods that in this class.

  • Write the Main() method. Similar to Main() in ObjectScript.DataEntry4, it will loop and call other methods.

  • Write a GetInput() method, that prompts the user for a lookup string, and returns a lookup type ("DOB" in this case), and a search string (the internal date of birth).

  • Write a Help() method, that lists the lookup alternatives.

  • For this version, the user may enter ? to get help, a date of birth, or press Enter to quit. Use ValidDOB() from ObjectScript.DataEntry4 to verify the date of birth and return the internal date of birth integer.

  • Write a DOB() method, that takes the internal date of birth as an argument. If the user enters a valid date of birth, DOB() checks to see if the internal form of the date of birth is in ^PersonI, and then loops through the index to find all IDs of the people with that date of birth.

  • Write a DisplayLine() method to display each person, by accepting ID as an argument, and printing all the data for the person.

For instructions, click below.

Step by Step Solution

FeedbackOpens in a new tab