CSE 11 Spring 2001
Homework #1

Required reading: Savitch book, Chapters 1, 2, and 3. This and all other reading assignments in the Savitch text does include the optional sections. Also start reading about and practicing file handling with the UNIX operating system.

Turn in due date: Thursday April 12 (i.e., 8 am April 13)
Interview due date: Tuesday April 17.

YOU MUST COMPLETE ASSIGNMENT 1 BY THE DEADLINES OR YOU MUST DROP THE COURSE. IF YOU MISS ASSIGNMENT 1 AND DO NOT DROP THE CLASS, YOU WILL RECEIVE A GRADE OF F FOR THE CLASS.

Note: Assignment 2 is harder than assignment 1. Get started on Assignment 2 right away.

For this and all assignments, if you take an interview BEFORE THE TURNIN DEADLINE, then you do not need to turn in the assignment.

Programming:
(Note that this sounds like but is NOT Programming Exercise 1 of Chapter 3 in the Savitch text).
Write a program that takes a one-line sentence as input and then outputs the following response: If the sentence ends with the question mark '?' and the input contains an even number of occurrences of the letter E, then output the word "Yes" . If the sentence ends with the question mark '?' and the input contains an odd number of occurrences of the letter E, then output the word "No" . Count both uppercase and lowercase versions of the letter E. If the sentence ends with an exclamation mark '!' , then output the sentence "I only answer questions!" . In all other cases, your program will output the input string enclosed in quotes followed by the phrase " does not sound like a question to me." . For example, the input
Hello there.
Should produce the output
"Hello there." does not sound like a question to me.
Be sure to note that, in the last case, your output must include quotation marks around the echoed input string. In all other cases, there are no quotes in the output. Your program should have a loop that allows the user to repeat this until the user indicates that she/he wants to end the program. Your program does not have to check the input to see that the user entered a legitimate sentence. Name the class for your program Answerer , so your program will be in a file names Answerer.java .

The program you turn in will use JOptionPane to do all your input and output using windows. However you should also be able to do input/output without JOptionPane ; you may be asked to convert your program to use System.out.println and SavitchIn , rather than JOptionPane . You must be able to convert the program in your interview, not simply show another file with the conversion already done.

Note 1:
You will always be turning in a Java program (or classes). You should compile it and test it, but when you turn it in, you only turn in the Java program, you do not turn in the compiled object code. So, the name of the file (or files) you turn in will always end in .java ; it will never end in .class. (We will compile your program and run it when we grade it.)

Note 2:
You may only use material from reading covered up to an assignment. For example, for assignment 1, you can only use material from Chapters 1, 2, and 3. For assignment 2, you can only use material from Chapters 1, 2, 3. and the chapters assigned for assignment 2. (This ensures that you exercise and receive practice on the intended material on each assignment.)

IMPORTANT: After you turn in your program for this or any other assignment, do not edit it or in any way modify the file that contains your homework assignment. This will ensure that we can check that you did the assignment on time if some grading software or records fail. If you want to use your program, make another copy of the program using the cp command. You can safely change this second copy.

Other Assignments: All other assignments will be posted in the public directory of the class computer.