This should have been a FAQ entry for a previous assignment, but better late than never. The answer is NO. The submission process is very clear about the subject line - you should use exact filenames, and exact subject line. After you submit, wait for about 2 minutes to receive a response back from the auto-handin. Make sure that the handin was succesful, and then leave.
If you don't receive a response, or you receive a response that says handin failed, re-check your subject line, case of the files, and send again. We will not consider emails regarding requests for submission after deadline because of these problems.
Do you by chance have a one letter word in your test sentence? Notice that according to our piglatin building knowledge, we cannot handle one-letter words (why?). So this is a special case that we are not going to deal with until the next assignment. As long as your program works with 2 or more letters, you are okay.
Yes. I am sorry about not making this explicit in the assignment - just like the sample run shows, you should assume that the user types in a period at the end of the 4-word sentence. So you should convert the last word assuming that the word will end in a period. You can also specify this in your comment to the user.
If you want to use the way it is shown in the book, you will need to put the declaration of all the constants OUTSIDE the main program, but inside the class, something like this:
class Letters {
public static final String LETTER_H = "...."; // The letter H
// the other ones as necessary go here as well
public static void main(String[] args) {
etc.
You can also follow the way we have talked about constants in class,
by simply using final String LETTER_H = "....";. This
can be placed inside the main method.
Yes, the message is longer than the 25 lines that a normal DOS window can support. A simple work-around would be to generate a message like "Press Enter to see the rest of the message..." and do a Console.in.readLine() after producing the first 3 letters, and then producing the last 2 letters.
We discussed this in class - I was in the right track, what I did not realize was that internally the time is stored in milliseconds. If you look at Time.java included in the ccj library, and see the definition of secondsFrom (just search for secondsFrom in that file, you will see a line like:
public int secondsFrom(Time t2)
{ return (int)(date.getTime() - t2.date.getTime()) / 1000; }
So, the difference is first calculated in milliseconds, and then divided by 1000 to get the number of seconds. Now, lets do some math:
If you use a 32 bit computer, the max. value of an positive int is:
232-1 = 2147483648
This is approximately 2147483 seconds.
Divide this by (3600*24) - the number of seconds in a day, the
result will be about 24.
Q.E.D.
This seems to be a bug in Cafe. Can someone having access to the Cafe 3.0 try running the following program and see whether you get the same behavior?
import ccj.*;
import java.util.*;
class Datenow {
public static void main( String [] args) {
System.out.println("The time now is " + (new Time()));
Console.in.readLine();
}
}
For this assignment, ignore this error. On cafe, as long as your result is 5 hours off, you are okay, since we would be doing the grading on a unix machine which does not have this problem. Sorry about the confusion though, anyhow.
Yes. Comparison of two times is easy if they are both of the same type. You already know how to find out the difference in seconds of two time objects.
For the second part, you can simply use 1999 for year and 0 for the seconds, but then your program will not work next year (somewhat like a Yany bug!). A better way would be to find the current year (how?) and put that in the constructor call.
My mistake of not making this explicit. You may assume that the hour is coming in 24 hour format (you should still prompt the user as such). So the value of 8 will represent 8 AM, while a value of 20 will represent 8 PM. 12 represents 12PM, while 0 represents midnight.
I have updated the sample run in the assignments page to accommodate this. For those of you who have already printed the assignments, please note this change.
Sigh. This is what happens when I rewrite the lab in a matter of hours before it is posted. I meant to ask you to display the report with the lab name indicated, something like:
You have about 168 hours to finish Lab3! Keep it up!
However, since I didn't do that, either way is fine, and you will not be penalized for not doing this (which is a simple change anyway).
Of course. But make sure that you specify the exact format in which you want the input. Be very clear about the format, because the graders will most likely not see the prompt if you don't make it explicit. Follow the sample run in the assignment only as a guideline, and make sure you ask for all the different components of the time (except for the second and year).