Art Metzer

Ranch Hand
+ Follow
since Oct 31, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Art Metzer

I think it's 23 pairs of chromosomes in the human body.
But only if you do a SELECT DISTINCT.
Art
21 years ago
Are you sure that the int you're passing to the elementAt() method is the variable from your for loop?
Art
[ February 08, 2002: Message edited by: Art Metzer ]
22 years ago
Wizard of Oz: "Why, anybody can have a brain. That's a very mediocre commodity. Every pusillanimous creature that crawls on the Earth or slinks through slimy seas has a brain. Back where I come from, we have universities of great learning, where men go to become great thinkers. And when they come out, they think deep thoughts and with no more brains than you have. But they have one thing that you haven't got: a diploma."
Scarecrow: "Joy! Rapture! I've got a brain!"
22 years ago
OK, this googlewhacking is turning out to be seriously addictive.
More news from the field: the combination of medical events and plant species seems to be the way to go for me: I've also discovered kleptomania and ficus's single link.
Not to introduce philosophical overtones into this little avocation, but assuming that Google has its Web crawlers tuned to Java Ranch, then our publishing of googlewhacked pairs means someday they will no longer be googlewhacked pairs.
Well, there's always link rot.
Art
22 years ago
I've gotten married in the past year, and googlewhacking.
Neither is easy.
It took me splenectomy + sycamore to get down to one link.
Googlewhacking is fun, it forces you to think of words whose ideas are opposite one another--but not too much--on some kind of conceptual color wheel.
Art
22 years ago
Tammy,
You might want to double-check the name of the method you're using. The method is "println()", not "printIn()". "println()" is short for "print line", so that's a lowercase-L in there, and not an uppercase-I.
Enjoy this journey that is Java,
Art
22 years ago
Hi, Douglas.
I'm a little confused by what you're trying to do.
Here is the code, I had to replace i's and j's with j's and k's, to avoid HTML italicization:

First off, the syntax on your for-loops is incorrect. From the Java Language Specification, "The for statement executes some initialization code, then executes an Expression, a Statement, and some update code repeatedly until the value of the Expression is false." So to print the numbers from 0 to 9,

The name of your method is display(), but it looks like you are not only wanting to display the contents of the array, but also populate it with random numbers. Maybe you could split this population out into another method, and then call display() after the 2D array is loaded? And do you want the random integers that you populate the array with to be from 0 to 6, or 0 to 9? Also, you should cast Math.random() to an int only after you multiply it by something, or you'll always get 0 as a result.
We'll be better able to steer you in the right direction if you tell us what you need this class to do, Douglas.
Thanks,
Art Metzer
22 years ago
Anthony--
Here are some hints to what I would do if I were faced with this requirement:
1. I would write a method (maybe, "isCharactersUnique()") to make this check, that takes the candidate password as its input variable, and passes back a boolean as its return value.
2. Begin by converting the input string to an array of characters.
3. Each character in this array needs to verify with every other character in the array whether the two are equal. As soon as/If two characters are deemed equal, you can pass back false; but if you run through all possible combinations and no matches are found, you can pass back true. And the solution to this problem of running through all possible combinations mirrors "The Handshake Problem", a well-known (solvable!) mathematical problem. The link I've provided here should give you a hint how to set up your loops to make your check.
It's a good problem, Anthony; good luck solving it.
Art
22 years ago

Hi, Andrew.
Here are the steps the code in your first example goes through:
1. You enter the "outer" loop in line 5, and go on to line 6.
2. i initializes to 0 in line 6.
3. j initializes to 0 in line 8.
4. Java executes the test in the "if" statement on line 10. Since i does equal j, we continue outer, which advances i from 0 to 1 at line 6.
5. At line 8, we're starting over in a new j loop, so j is once again initialized to 0.
6. The test at line 10 fails, so we don't continue this time. Instead, we print output: i = 1, j = 0.
7. Since we're at the end of the inner for loop (j) and we've no reason to leave it, j advances in line 8 from 0 to 1.
8. i still equals 1, and j equals 1. The test in line 10 evaluates to TRUE, so we once again continue outer, which advances i from 1 to 2 on line 6.
9. Since the condition i > 2 evaluates fall, the outer for loop, and the program, terminates.

Looking over what's been printed to the screen, Andrew, only one line has been: i = 1, j = 0.
You can follow similar step-by-step logic to analyze the second example, keeping in mind that "continue" without the label refers to the innermost loop.
Good luck,
Art
22 years ago
Hi, everyone.
Barry, two things: your code will only do the "do something" if all of the taboo words exist in the string; I think Ben wants to not post the message if any of the naughty words exists in the string.
Second, even if Ben changes the &&'s to | |'s, Java will still have to do an indexOf() on every word in the list every time, even if the first one in that list invalidates the message. Could Ben do something like this?
1. Put the list of sought words in an array of Strings.
2. Set up a boolean, badWordFound, to false. Set up an int counter to zero.
3. Go through a while loop: While badWordFound is false, AND the array still has Strings to look for in it, loop.
4. If the array's word at position "counter" is found in the message string, set badWordFound = true.
5. Increment the counter
6. **End of while piece of code**
7. if (badWordFound) do something else postMessage()
Possible, no?
Art

[This message has been edited by Art Metzer (edited December 05, 2001).]
22 years ago
How about....
agile crab/algebraic
relating/integral
armpit race/parametric
?
Art "Don't ask me what an agile crab student is" Metzer
22 years ago
I've heard that Snood can be tragically addicting, but I've never partaken myself.
Art
22 years ago
I dunno why you're getting the NoSuchMethodError; I can compile and run your code snippet fine. You may have to display more of your code to get the source of the error.
And as an added hint, to do what you're wanting to do:
I think you want to replace 26 with j in your println() call.
Before printing, you'll want to cast your sum to a char. Otherwise, your output will get cast up to an int.
Good luck debugging the error,
Art
[This message has been edited by Art Metzer (edited November 13, 2001).]
22 years ago