Originally posted 7 September 2012, due at 11:59 p.m. EDT on Monday 17 September 2012, by placing a .java file in your cs187 directory on your edlab account. For more information on accessing the edlab, see here or ask in discussion section on 12 September.
Goals of this project:
This assignment is not graded, but must be completed on time in order to continue with programming assignments.
Your assignment is to create a Java class called "Echo". An Echo object has one method, called "echo", which takes one parameter of type String and returns a String. We will test your class with the following driver:
public class EchoTest {
// driver for Assignment 0, tests Echo class
public static void main (String [ ] args) {
Echo x = new Echo( );
String output = x.echo ("Cardie");
if (output.equals("Cardie")) System.out.println ("pass test 1");
else System.out.println ("fail test 1");
output = x.echo ("Duncan");
if (output.equals("Duncan")) System.out.println ("pass test 2");
else System.out.println ("fail test 2");}}
To be correct, the command "java EchoTest" must report that the two tests are passed, when it is run in a directory that contains your Echo class as well. You should put your class in your EdLab space, in a directory called "cs187/proj0", and test the behavior. You may test your code by putting a copy of this EchoTest class in the same directory and running it. (But note that we will test your code with our own copy of EchoTest.)
If you create your code within Eclipse (which we encourage but don't require), you will want to ignore the warning message that says "The use of the default package is discouraged". Bear in mind that if you make the mistake of declaring the Echo class in a package, our EchoTest class will not see it (since it will not be in a package) and we won't be able to test your code.
Last modified 8 September 2012