Chuck Holowecky

Greenhorn
+ Follow
since Feb 09, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chuck Holowecky

Thank you Ilja, that was the problem.

Chuck
I'm relatively new to eclipse and I�m using it to write my programs for the Cattle Drive. Everything has been going well and I�m now working on the NaturalLanguageMultiply assignment. For some reason I�m now having a problem. My compile errors aren�t showing up in the �Problems� tab at the bottom of the screen when I save my program. Some of them do show up on the left side of the edit screen. For instance if you don't end a statement with a ";". But the non syntax errors don't show up until I run the program. How can I fix this?

Chuck
But the name of the zip file is jr.zip. How can it be found if the pathname is JavaRanchCommon.zip?

Chuck
17 years ago
I don't understand why the classpath entry is JavaRanchCommon.zip. I downloaded the file for this assignment and viewed the contents. I see no such file. I understand the format of the import statement for this assingment but not the classpath. Can someone please explain?

Thanks,

Chuck
17 years ago
Oops. I forgot about that "final" detail. You don't want anyone to change a value that isn't supposed to be change at all.
17 years ago
While going through the Cattle Drive we are reminded to declare our variables as close as possible to where they are used. In the infamous �Say� assignment, I defined the variables �onebillion and �onemillion� to represent their respective numeric values. It would be easier than counting all the zeros. Pauline suggested that I define them at the Class level instead of just before I used them. I was confused because I thought this went against the style guide. After further reading, the following may clarify when to define a variable at the Class level and when to define it locally.
Static class variables represents class-wide information. In certain cases, one copy of a particular variable should be shared by all objects of a class. Since oneBillion, oneMillion and will never change, its best to declare it as static at the class level. This may not be that important in this assignment, but it will certainly be important as multiple objects will be instantiated from a single class in future programs.
17 years ago
I don't understand why I'm getting an error on this piece of code. I started with my code from 4a and just added a case statment to build the words for the numbers entered. In my system.out.println, statement I get and error that says: "The local variable tensWord may not have been initialized". If I try to initialize it earlier in the program, it says: "Duplicate local variable tensWord." If I move the Sting statement that is after the Case 2: statment just before the system.out.println statement it compiles fine but doesn't accomplish what I want . So what's the difference???


switch( args.length )
{
case 12:
case 11:
case 10:
case 9:
case 8:
case 7:
case 6:
case 5:
case 4:
case 3:
case 2:
String tensWord = firstWord[(int) (numberEntered / 10)];
case 1:
String onesWord = buildSecondWord( numberEntered ); System.out.println( tensWord + onesWord );
}
17 years ago
I believe I've got my design down for the solution to this program, but my problem is how to handle the incoming string. My thought is to convert it to a long, but there doesn't seem to be enough info in "Just Java 2" as to how to work with type long. I took me a while just to figure out how to convert the string to a long and to put an "l" after the 999999999999 when checking to see if the number entered is within range. Should I create a long object? Where do I learn to work with long objects? Can I parse out or substring out a long like I can an int?

Chuck
17 years ago
I ran this question by Pauline McNamara and she suggested I post it on this forum.
I�m on the 4th assignment of the Cattle Drive and I see that the nitpickers guide you to developing the simplest and clearest possible solution. It's ironic how much effort it has taken me to make my assignments more simple. It seems like I should arrive at the simplest solution sooner than I have been.
Do you have any advice on how I may want to approach a solution to a problem or is it just a matter of experience?
17 years ago
This is the section of code that I'm refering to. It seems odd to me to pass a return value that is an expression, instead of a single value or variable. I'm assume that the expression is evaluated and then the results (true/false) are passed back to whoever call the method.


boolean isLeapYear(int year)
{
boolean y4 = ( (year % 4) == 0 );
boolean y100 = ( (year % 100) == 0 );
boolean y400 = ( (year % 400) == 0 );
return ( y400 || (y4 && ! y100) );
}
17 years ago
On the last section of the style guide there is an example of a method called isLeapYear. It returns a boolean value. Instead of returning a variable with a boolean value, one can insert an expression that evaluates to a boolean value?
17 years ago
Thanks a lot! You guys are very helpful.
17 years ago
Can the Style Guide be put into a .pdf file so that it can be downloaded and printed? It's a lot easier reference it that way rather than to flip back and forth between screens.
17 years ago
How do you know which chapters to read for each assignment? Do you just look up the necessary topics in order to complete each assignment?
17 years ago
I have taken a couple of java clases and will sign up for the Cattle Drive. What should be my next step after the Cattle Drive in order to get my SCJP?

Thanks,

Chuck