HTW Berlin Medieninformatik HTW Berlin
Fachbereich 4
Internationaler Studiengang
Internationale Medieninformatik (Bachelor)
Info 1: Informatik I
Winter Term 2022/23

Laboratory 6: Technical Support

Pre-lab

This week's lab work is intended give you practice using the Random class and HashMaps.

What to Bring to Lab

Please bring these exercises printed out or written out with you to lab. Please have your name on your page.

P1. Using the Java documentation on Map and HashMap, write a short paragraph explaining what a HashMap is, what its purpose is and how it is used.

P2. HashMap is a parameterized class. List the methods that depend on the types used to parameterize it. Do you think the same type could be used for both parameters?

P3. How do you check how many entries are contained in a map? What happens when you add an entry to a map with a key that already exists in the map? How do you print out all the keys currently stored in a map?

P4. Where can you find information about javadoc on the Internet?

Post-Lab, AKA  What To Turn In

Your completed assignment, submitted in Moodle as a pdf, should include:

Lab assignments are due the night before your next class at 22.00. They may, of course, be turned in earlier. You hand them in by preparing the report in PDF and submitting it to Moodle.


Assignment

Technical Support

  1. Download the basic TechSupport project that we used in the lecture. Expand it to give random responses as we did in class.
  2. Now use the method split from String and a HashMap to give appropriate answers, depending on the input. Make up lots of cool responses.
  3. How can you deal with punctuation marks? What if there is more than one space between words? Can your tech support system deal with this?
  4. Ensure that the same default response is never repeated twice in a row.
  5. When no word is recognized, use other words from the user's input to pick a well-fitting default response: for example, words such as "why", "how", and "who" might be useful.
  6. Document your code thoroughly using JavaDoc!
  7. (For the bored) There are often synonyms that should provoke the same response. Can you figure out how to store only one response even if there are a number of different words that trigger this response?
  8. (For the really bored) Make your answers multilingual. At first you can just set the language at any point, but then you want to read the locale from the local machine to determine how to answer.
  9. (For those who are bored during lockdown) Choose your answer language at random, and include Hebrew and Arabic script as possible languages for answers. Note: These languages are written right to left. Yes, Java can deal with it. You'll have to do some research.
  10. (For those who are really, really bored during lockdown) Record your voice speaking each of the responses. Make your TechSupport bot switchable between text writing and speaking, using the MusicOrganizer's sound playing ability to bring your bot to life. Go wild!

Writeup

Submit your writeup as your post-lab to the Moodle area.

 


Copyright Prof. Dr. Debora Weber-Wulff
Questions or comments: <weberwu@htw-berlin.de>
Some rights reserved. CC-BY-NC-SA - Copyright and Warranty

The exercises are adapted from Objects First with Java, A Practical Introduction Using BlueJ. David Barnes & Michael Kölling, 2016