Skip to content

chbrooks/Intro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Introduction to Java

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:

  1. Compile and run CountChars.java
  2. Complete the nVowels method in CountChars to count the number of vowels in the input string. (assume that y is not a vowel.)
  3. Complete the hasPunc method in CountChars to determine whether the string contains punctuation (assume that everything other than a letter or number is punctuation).
  4. In MathUtils, complete computeDistance, computeGeometricSeries, maximum, minimum, power.
  5. 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'.
  6. 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."
  7. 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")
  8. In Eliza, add conversation to getResponse. if the user types "joke", return a joke.
  9. 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?"
  10. 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?"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages