Course Links

Exercises

Resources

External

Outline

This assignment has two main purposes. The first is to help you become familiar with some of the resources available to help you succeed in the course, and get you used to using them. The second is to review the programming concepts you learned in CSC 111 (or its equivalent), while beginning your introduction to Java. This assignment should use techniques and ideas that are already familiar to you, but implementing them using the Java syntax and compiler will be new.

You will document your work for the first part of the assignment in a written journal entry. These reflections, which you will be completing each week, will normally serve as a chance to consider and describe what you have learned from the assignment, any areas where you had trouble, etc. For this first assignment in particular, you will augment it with the information described below. This part of each week's assignment should be submitted alongside the code, in a file called readme.txt. It is described more below, as well as in the above link.

For the second part of the assignment, you will submit the file containing the Java source of your program as assign1 (with file names as specified below), together with a typescript file showing the compilation and execution of the program. In general for each assignment you should always submit the readme.txt and all files necessary to compile your program; in the future some specific assignments may also ask for additional elements. These will be listed in a checklist at the bottom.

Resource Exploration

Most experiences are more fun when shared, and programming is probably no exception. Your classmates can serve as a source of support, inspiration, and ideas. Read the policy on collaboration in the syllabus and notice how much freedom it gives you to discuss the project with your peers. I want you to use that freedom!

Program: Conversation

For the main part of the assignment, you will write in Java a program similar to those you might have written in CSC 111. (In fact, this project is based on an assignment given in that course by Judy Franklin.) Your program will carry on a simple conversation with the user.

The program you will write is a simple chatbot, a form originally popularized by the program called Eliza. It will ask the user to choose a number of rounds of conversation in advance. Then it will take turns printing messages to the user and accepting responses until the specified number of rounds are complete. Finally it will print a transcript of the entire conversation.

If at any point the user's input contains words that can be mirrored ("I" <-> "you" for example) then the computer's next response will be a mirrored version of the previous statement. Otherwise it will select from a set of canned phrases. Below is one sample conversation, with the user's input in red.

$ java Conversation
How many rounds?  2

Hi there!  What's on your mind?
I'm thinking about clouds.
You're thinking about clouds?
Yes, but nothing very profound.
Mmm-hm.
See ya!

TRANSCRIPT:
Hi there!  What's on your mind?
I'm thinking about clouds.
You're thinking about clouds?
Yes, but nothing very profound.
Mmm-hm.
See ya!

Follow this link for a more detailed description of what your program should do.

Hints

Start early on this assignment so as to give yourself plenty of time. You don't want to get behind in the first week! Although you may have written a similar program before, many things are different with Java.

For this assignment, you will not be required to catch exceptions that might be generated by the user entering unexpected input (such as something non-numeric for the number of conversation rounds). However, solutions that do so properly will be considered for extra credit. You also shouldn't worry yet about creating multiple classes; a single class with static fields and methods will do.

Because Java has an extensive web presence, you may be able to find code on the web related to this and other assignments. Resist the temptation to copy from these sources! Code taken from the web will not necessarily meet the requirements of this assignment, even if it solves the same general problem. Furthermore, representing someone else's work as your own is a violation of the Honor Code. (That said, looking at examples for ideas and general concepts is acceptable, so long as you then proceed to write the program on your own.)

Grading

Your grade on this homework is based on several factors. Most important is completeness. A program is considered complete if it compiles and executes more or less as described, is documented with a readable typescript, and includes adequate reflection. Programs turned in without a typescript or readme will not receive full credit. Programs that do not compile without errors will receive a grade of C at best. You have to submit all the files before the deadline. (An automated utility will collect the submissions at the deadline. Late submissions will therefore not be collected or graded.) Adherence to the style and documentation standards is another factor. Please follow the Javadoc style rules as described in class. Finally, I will evaluate your code for coherence, organization, and clarity. For this assignment, I will also assess the elegance of your approach to handling mirror words and punctuation.

Your written reflection will be graded only based on the thought and effort displayed by the entry; all reasonable submissions will receive full credit. For this assignment, the reflection should describe the differences between Python and Java you experienced while completing the assignment. What are your initial impressions of Java? Can you draw any conclusion about programming in general from the similarities or the differences between the two languages? You may also use the reflection as a means of expressing to me parts of the assignment that you found difficult, did not complete, etc. Do not fear that your grade will be lowered because you tell me that something is unclear to you; in grading, I will rely only on the evidence of the programs and typescript you submit. The reflection serves simultaneously as a means of self-improvement for the student, a form of feedback for the professor, and a way for the class to share ideas as a group. A final reminder: don't forget to tell me which TA session(s) you visited!

To Submit

Submit the following as assign1:

Quick Start