Develop an instantiable class for this application which contains:

  • A class definition
  • Suitable data members (instance variables)
  • A constructor
  • A setter method to set the given item (i.e. piece of text)
  • A compute method to determine if the provided item is valid according to item and the rules assigned to you based on Table 1, otherwise the item is deemed invalid. (no regex)
  • A getter method to return the validity of the item

For example:

  • if the item is "D01 K6W2" then the compute method should determine that the item is valid, and store that information in the corresponding instance variable
  • if the item is "T12 DW6P" then the compute method should determine that the item is valid, and store that information in the corresponding instance variable
  • if the item is "123 DW6P" then the compute method should determine that the item is invalid and store that information in the corresponding instance variable
  • if the item is "T32 DW6P14" then the compute method should determine that the item is invalid, and store that information in the corresponding instance variable

Name the instantiable class ItemChecker.

1. Prompt the user to provide an Eircode

2. It should work even if the user provides text in both uppercase and lowercase letters. The text will be converted in all uppercase letters.

3. After converting the text in all uppercase letters: Check if the Eircode is valid. Format: LDD CCCC (starts with a letter, continues with 2 digits, space, ends with 4 characters - either letters or digits in any order. Digit: numbers from 0 to 9.

4. Develop another compute method which takes in as parameter a number (user id), create user ids, and store those items in an array of String items. The method must return the array of computed items.

User id: 8 characters, first 5 characters are lowercase letters (a-z), followed by any 3 digits (one of the following: 1, 3, 5, 7, 9). The method creates user ids by randomly selecting letters and digits. A letter or digit can appear more than once in the same user id.

Develop an application that uses the instantiable class ItemChecker (the instantiable class previously developed in Question 1. a.) to check the validity of the given items (i.e. pieces of text). The application should allow a user to enter multiple items. Please check Table 2 Approaches to entering multiple items to check their validity for details about the approach you have to implement in order for the application to check multiple items.

The application will display on the screen if the given items are valid or not. In the application class, please add a short comment for each method of the ItemChecker class that you use/call in your application to explain why that method is needed. Name the application class ItemCheckerApp.

ItemCheckerApp:

1. Ask the user how many eircodes they would like to check, and ensure that the application enables the user to provide that amount of eircodes and for each Eircode, check its validity.

2. Display on the screen if the given eircodes are valid or not.

3. Ask the user how many user ids he would like to create.

4. Call the "other method" defined in the ItemChecker to create the items.

5. Display on screen the user ids created.

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.