Computer Science 332
Theory of Computation
“A Nine Point Five?”
due Tuesday, September 7, 2004 by noon
In this assignment, you are to write a program that is functionally equivalent to a correct version of the first, “nine”, assignment. This time, however, you are to use a particular algorithm.
The algorithm that you are required to implement is “state-based”. In particular, your program should have a variable named “State”. As you read each character, the value of State may change depending upon the current character, the current value of State, or both. After you have examined each character of the word in turn, the value of State should tell you whether or not your word contained “nine”. The details of the changes will be discussed in class.
As before, you may write your program in Java, and you may use the String class, but you may not use any member functions that return more than a single character. The only exception is for input or output.
Note that if your original program had a boolean function that took a string and determined whether or not it contained “nine” in your previous program, this assignment requires you to change only that function.
The class containing your main method is to be named Nine. Any variation from this name will result in a deduction. Likewise, your prompts and output are to be EXACTLY as specified in the sample run. (There is a space after the question mark in the "Word? " prompt. This is important as the assignment may be graded electronically!
You are to mail the file Nine.java to me (at dlevine@cs.sbu.edu) such that I receive it by noon on Tuesday, September 7.