CS 2110 Assignment 1 FAQ
Posted 9/4/2009 23:56:42 1. Q: What characters will be in command names?

A: Upper and lower-case alphabetic characters only. There will be no spaces or other characters.

However, your reader should ignore whitespace surrounding a command.

Posted 9/5/2009 0:12:03 2. Q: Can my constructor for DNAParser throw an exception?

A: Yes. Your constructor for DNAParser may throw an exception if you like. However, this exception should not be thrown during our testing.

See snews://newsstand.cit.cornell.edu:563/h7kmm5$f31$1@ruby.cit.cornell.edu

Posted 9/5/2009 0:20:35 3. Q: What characters can be in a value?

A: Everything between the quotes is part of the value. The only characters that cannot be in a value are quotes and line breaks.

See snews://newsstand.cit.cornell.edu:563/h7o93k$d9i$1@ruby.cit.cornell.edu

Posted 9/5/2009 0:24:19 4. Q: Can I include classes besides my implementations of DNAParser, SpeciesReader, and Genome in the .jar file I turn in?

A: Yes.

Posted 9/5/2009 0:26:38 5. Q: What should my classes be named?

A: When grading, we are looking for correct implementations of the interfaces. The names of your implementations are up to you, but of course they should reflect what the class is.

Posted 9/5/2009 0:32:38 6. Q: The assignment says to use a HashMap to associate genes with numbers. Do I really have to use a HashMap?

A: You should really use a HashMap. It's the best data structure for this task, and you should also get experience with Java's Collections and generics.

But we told some people they didn't have to, so you don't have to either.

See snews://newsstand.cit.cornell.edu:563/h7q06l$st9$1@ruby.cit.cornell.edu


Posted 9/5/2009 0:39:50 7. Q: Do I need to write the static main method described in the assignment? Are you going to grade it, or is it just for my own edification?

A: You should write a main method that loops over command line arguments and exercises your implementations of SpeciesReader, DNAParser, and Genome appropriately. This is a good test of your classes.

However, some students have been told they do not need a main method. Therefore, you will not be penalized for not having one.

See: snews://newsstand.cit.cornell.edu:563/h7q06l$st9$1@ruby.cit.cornell.edu

Posted 9/5/2009 0:44:18 8. Q: It says SpeciesReader implementations are supposed to throw an exception for malformed DNA strings, but the interface doesn't seem to permit that. Do I have to throw an exception on bad DNA?

A: No. We're not going to test your classes against bad DNA anyway.

Posted 9/5/2009 0:49:16 9. Q: I heard you're planning to release a test suite that we can run on our assignments before we turn them in. Where is it?

A: The test suite is now available. See the assignment web page

Posted 9/5/2009 0:53:14 10. Q: Why can't I submit my assignment to CMS?

A: CMS turn-in is now open. Please run the test suite before turning in your assignment

Posted 9/5/2009 12:07:00 11. Q: Do I need to have a Gene class to store the genes?

A: You don't need to. You're welcome to store genes internally in a Gene class --- indeed, from an object-oriented programming perspective, this is a natural thing to do.

But the interfaces we've provided represent genes as Strings, so you'll have to translate between your class and strings to implement them.

Posted 9/7/2009 12:56:42 12. Q: How do we parse DNA strings where starting sequences and ending sequences overlap against other genes?

For instance "AOC AAAA ICA AA ICA" or "AOC AAA AOC III ICA"

(spaces added for readability; DNA strings will never contain spaces)


A: For "AOC AAAA ICA AA ICA": treat AAAA as a gene and the rest junk
For "AOC AAA AOC III ICA": treat AAAAOCIII as a gene and the rest junk

Follow these three rules:

* Parse the DNA from left to right

* A gene begins with the first AOC that is not in a gene already.

* A gene ends with the first ICA that occurs after the opening AOC.

Posted 9/8/2009 9:51:53 13. Q: When is the assignment due?

A: Wednesday 9/9 remains the official due date. However, we have added a 5-day, penalty free grace period on CMS, because of the late lecture start and having released the test suite late.

So you may turn in the homework with no penalty up until Monday 9/14 at 11:59pm.

Posted 9/8/2009 10:58:54 14. Q: The test suite says something about failed line breaks. What is this?

A: The test suite attempts to determine what kind of line break your program
expects. You only need to pass one of these tests. If you've used
BufferedReader, you should pass both.

If both tests fail, this means that the test suite can't make your
SpeciesReader work with either kind of line feed. It means you have some
unrelated problem. Read the diagnostic info.

Posted 9/8/2009 18:19:02 15. Q: What do I do with "AOCICA"?

A: Treat this sequence as junk. A gene always has length greater than or equal to 1.

Posted 9/8/2009 21:46:39 16. Q: The test suite says:

"Tip: The constructor should leave SpeciesReader in a state where getCommand() and getArgument() work, without readNextLine being called first."

What does it mean?


A: This code should work:

SpeciesReader reader = new SpeciesReader(filename);
System.out.println("The first command is: " + reader.getCommand());

Note that readNextLine() is not called prior to calling getCommand for the first time. The SpeciesReader constructor should position SpeciesReader so that it is already at the first line.

Posted 9/10/2009 20:39:53 17. Q: Should a "SpeciesReader" make a DNA Parser or Genome? (Or vice versa and any other combination)

A: No.

There has been some confusion about this because of the main method. See Q7.

SpeciesReader itself should only deal with reading and returning information from a file. DNA Parser should only deal with the DNA that gets passed through the constructor. Genome should only deal with DNA added to it and requests for that DNA.