30 points, due August 23, 2020 at 11:59pm. You should make sure that all of your code is submitted to your GitHub repository by then. I strongly recommend that you commit your work early and often.
This lab is intended to give you experience working with Java; compiling and running programs, using basic control structures, and implementing simple methods. We will begin it in class; you should complete the lab on your own as necessary.
Each task is worth three points, graded as follows:
3/3: code is complete, functions correctly, and is well-designed and commented.
2/3: mostly complete - small errors, unnecessary code, poor documentation.
1/3: not working correctly.
0/3: incomplete.
Tasks:
- Compile and run CountChars.java
- Complete the nVowels method in CountChars to count the number of vowels in the input string. (assume that y is not a vowel.)
- Complete the hasPunc method in CountChars to determine whether the string contains punctuation (assume that everything other than a letter or number is punctuation).
- In MathUtils, complete computeDistance, computeGeometricSeries, maximum, minimum, power.
- In Eliza, add a loop in the main method to keep asking "What do you want to talk about?" Stop when the answer is 'Goodbye'.
- In Eliza, complete the static method getResponse. Choose three foods - if the user inputs one of those foods, give a specific reply. Otherwise, reply "I don't know about that."
- In Elize, extend getResponse to respond "I love cake!" if the word 'cake' is anywhere in the input. (for example: the input could be "chocolate cake" or "cake pan" or "vanilla cake with frosting")
- In Eliza, add conversation to getResponse. if the user types "joke", return a joke.
- Challenge: handle "I am" statements. Let's make Eliza a little smarter. In getResponse, if the user types "I am X", return "Why do you say that you are X?"
- Extra challenge: Let's make her even smarter! In getResponse, handle sentences like "Sometimes I am X" or "Today I am X". Return "Why do you say that you are X?"