Objectives

On completion of this lab you should be able to:

  • build a small, console-based application using ArrayList, HashMap and HashSet.
  • integrate code to tokenize Strings into the above app.
  • use the Random class to return random objects from a collection.

Developing Tech Support 2 application

In this section, you will:

  • download the solution to Tech Support 1 that we covered in lectures.
  • familiarise yourself with the functionality and classes in the solution.
  • refactor the code so that the system replies with a random response from a list of pre-defined responses.

Tech Support 1

  • Download and extract the solution to Tech Support 1.

  • Import it into Eclipse and familiarise yourself with the code. The app:

    • is a console based system.
    • is a textual dialog system i.e. you enter text on the console and the system will provide a response.
    • responds with the same String always: “That sounds interesting. Tell me more…”

Tech Support 2

  • Create a new project in Eclipse and call it Tech Support 2.

  • Copy the java files from Tech Support 1 into Tech Support 2.

  • Make the necessary changes to this project so that the system provides a random response from a list of pre-defined responses e.g.:

    • "That sounds interesting. Tell me more..."
    • "I need a bit more information on that."
    • "Have you checked that you do not have a dll conflict?"
    • "That is explained in the manual. Have you read the manual?“
    • " That's not a bug, it's a feature!"
    • "Could you elaborate on that?“
    • etc.
  • Use your lecture notes to support you in this task.

  • Test your completed app to make sure it behaves as expected.

Developing Tech Support 3 application

In this section, you will:

  • refactor the code from the previous step to have this functionality:

    • Based on the user input, the system provides a context-sensitive, generated response from a list of pre-defined responses. If the system cannot find a suitable generated response, it returns a random one.

Tech Support 2

  • If you are not happy with your solution from the previous step, download and extract this version of Tech Support 2. Then import it into Eclipse and familiarise yourself with the code.

Tech Support 3

  • Create a new project in Eclipse and call it Tech Support 3.

  • Copy the java files from Tech Support 2 into Tech Support 3.

  • Make the necessary changes to have this functionality:

    • Based on the user input, the system provides a context-sensitive, generated response from a list of pre-defined responses. If the system cannot find a suitable generated response, it returns a random one.
  • Use your lecture notes to support you in this task.

  • Test your completed app to make sure it behaves as expected.

Solutions

The solution to the Tech Support 1 project is here.

The solution to the Tech Support 2 project is here.

The solution to the Tech Support 3 project is here.