Programming Project 2

Due at the beginning of Lab 3

This programming project may be done individually or in groups of two. Keep in mind that you may not work with the same person on more than two of the programming projects. If you work with a teammate, hand in one copy of your code with both names on it. It is okay to get help from the TAs and/or the instructor if you get stuck, but you should try to do it on your own first.

For this project you will be writing a program similar to the one you wrote for the Talking Robot Lab. Read the entire project description thoroughly (including the Design and Implementation Suggestions section at the end!) before starting your implementation.

Problem Description:

The current talking robot is operated by a remote control. Two buttons on the remote control represent asking the robot a question and getting the answer. If you press the first button, the robot asks, "What is your question?" Unfortunately, the robot, as currently implemented, does not know how to recognize questions. Instead, if you press the second button, the robot gives a randomly-chosen "answer" such as "Definitely!", "OK", or "No way!", without knowing what the question was.

You have been hired by the makers of the robot to help create a new and improved version. Your focus will be to improve its conversational skills by making its choice of answers depend on the content of the actual question asked. The robot will not be able to appropriately answer all possible questions (which would be very tough to do!), but it will be able to recognize a small number of predefined questions or phrases, like "What's the weather?" or "Is it time for lunch yet?", and be able to give a variety of randomly-chosen answers for each question or phrase.

The robot makers have hired a different team to implement the "speech-to-text" part of the program, which hears the question and translates it to a String object. Your job is to create software that gets a String representing a question from the "speech-to-text" module and generates a response to the question.

Basic Program Specification:

More Advanced Option: If your program requires a question to match one of your expected questions exactly, word-for-word, then your robot will fail to give an appropriate response when there are slight changes to the wording of the question. For example, one of your possible questions could be "Is it time for lunch yet?" If your program requires the question to match exactly, then it would not recognize the very similar question "Isn't it time for lunch yet?" As an alternative, you could look for certain keywords or phrases instead of whole questions; for example, check for the word "lunch" anywhere in the question or, for a different type of question, look for the word "Who" as the first word.


You may want to create a list or table similar to the design you developed for the Talking Robot lab that shows your various questions/statements (or, for the advanced alternative, phrases or keywords) and, for each one, the set of three (or more) possible answers. You should also decide on what response you will generate for unrecognizeable questions.


Develop your program using incremental development. At each step, add a little functionality that gets you closer to your end goal, and test it.

Submit to Moodle the external user documentation (README) and the source code (.java file) for the main class you created.