David Kaplowitz

Greenhorn
+ Follow
since Feb 08, 2005
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 David Kaplowitz

Thanks a lot, Mark. That info helped get me on track with the pattern match. I'll check out that tutorial you linked to.

Best,

Dave
15 years ago
Hello,

Basically what I want to do is to take a string, and see if there's a single non-letter character return a boolean value.



But I'm only getting a false when all chars are non-letter. Should I be iterating the String in a loop and doing a comparison of the chars, or is there a way to do it with the regexp and I'm just not seeing how to do it?

Thanks for any hints,

Dave
15 years ago
Hello,

I have the following code:



The look of the field on the gui is a little slit, thus is unreadable to the user. If I try to expand the size of the field with a string of white space (see commented line in the code), it throws errors when the user enters a value. I want to expand to some type of default open field for the user to enter a value between 1-70, but I don't really know how to format this field to make it look readable.

Thanks for any pointers on what I should be using either instead of JTextField or how I'm misusing it.

Dave
15 years ago
I know a good Windows text editor like UltraEdit does this ("replace in files"). If you're looking for a good cmd-line (linux/unix) utility, look into rpl, which is the best way I know of to do this type of task, much simpler than sed/awk or Perl.
15 years ago
Okay, I think I stumbled onto most of my answer on my own by making the following changes:

I still don't know how to change the return value of "change = (int) cash / 10;" to just a single digit number instead of a decimal value. So if I divide 90.00 with this program it says my change in tens is 9.00, I just want it to say "9". But that's the least of my worries after having figured out the % thing.
17 years ago
I have a change making program I'm writing that asks a user for a monetary amount, then it breaks down that amount into smaller values.

So it uses the Scanner class to elicit a double like 99.99. I want it to use 10.00 as it's largest amount and give 9 x 10.00, 1 x 5.00, 4 x 1.00, 3x .25, etc.

So far I have the following:



Where I'm tripping up is in the division. I'm getting back the wrong amount back (9.998999999999999). I want to divide by 10.00 and get the remainder in a separate variable to then be divided by 5.00, etc.

I don't really get how the whole widening conversion thing works, and I _really_ don't get how to use the % operator in this context to divide by 10.00 and get the remainder of 9.99 back into some type of useful variable that I can then divide?

The book I'm reading explains it, but I seem to be too thick to get it to work on my own.

Thanks for any help.

Dave
17 years ago