CS 160

Lab 7

Today's lab will test your knowledge of classes, methods, using the API and solving problems.

You will create two classes, and include a third class, ConsoleReader. One class will be the driver that has your main method. My main method had two lines, I created an instance of my second class, and then I called a go() method that started the program. Your second method will have several methods using whiles, switches, and do/whiles to solve the problem.

The problem:

You are to write a program that will complete the following tasks:

Here is a sample output of my program running. Sample Output Here are the steps the user picked to get this output.

  1. Gave the input String
  2. Selected count a letter and chose 's' as the letter
  3. Counted the words.
  4. Changed the input String to one with a bunch of spaces.
  5. Counted the words again (notice it ignored the white space)
  6. Chose exit

 

Hints:

Other things you will need to use to solve the problem.

The steps you should take to make it easier:

Go step by step.

  1. First get the user input working.
  2. Then get the menu to print out.
  3. Then get the switch statement set up.
  4. Then get exit to work.
  5. Then get the resetting the String to work.
  6. Then work on counting letters or words.

Compile often. Compile after each step.