wood burning stoves*
The moose likes Cattle Drive and the fly likes Question re: Assignment 1.4 Extra Credit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Question re: Assignment 1.4 Extra Credit" Watch "Question re: Assignment 1.4 Extra Credit" New topic
Author

Question re: Assignment 1.4 Extra Credit

Jeff McIlvain
Greenhorn

Joined: Jan 24, 2001
Posts: 17
Do you use the subset() method for the extra credit, or is there another way. I just can't see an effecient way to achieve this without using the subset method.
Thanks ~ Jeff
Brian Tomlin
Ranch Hand

Joined: Dec 06, 2000
Posts: 31
Jeff,
What class is the subset() method located in? I'm not familiar with that method.
Jeff McIlvain
Greenhorn

Joined: Jan 24, 2001
Posts: 17
Brian,
I meant to say substring() method. Sorry about the confustion.
Jeff
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
At first I used substring() and then I switched to charAt() and got this to work with both methods. I am not using either now and just playing with math functions and I think it is a bit more readable (I don't want to list these because that would take too much fun out of trying to figure it out yourself ). But substring() will work.
Bill
Brian Tomlin
Ranch Hand

Joined: Dec 06, 2000
Posts: 31
Thanks for the clarification Jeff. I read the whole darn JavaDoc trying to find that Subset() method and never did find it.
I too am having a little trouble with this assignment. I am still working on my first submission and I am using the charAt() method like Bill had mentioned. It does work, but I have been reluctant to submit it because I know that there has to be a better way.
After coming this far with the other assignments, I know that the nitpicker will surely reject it. I am trying to figure out what she will not like before I submit it. I'm sure I will still have to re-write it though, but that's part of the fun!
So Bill, you're not using any standard methods to figure out what character you're dealing with? I must be missing something because I don't see any way of determining this.
Any way you can clarify your math process without giving too much away?
Thanks!
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
Brian, I wouldn't get too nervous. You may want to submit if you have it working and you have cleaned all the obvious mistakes. That is what I have done, and with the help of Marilyn I was able to see the best solution. However, I may have given Marilyn more work by doing that, but I did think my solution was correct each time I have submitted it. With that said, there were a couple of times that I submitted with some spacing and other general errors that I definatly should have caught, sorry Marilyn .
As for the function, I at first went through it a character at a time, placed them into an array. That is where I used substring or charAt. When doing that I saw a pattern that I was able to throw into a method for each hundred places. Then I was able to use simple divide and modulo to pass a number to that method.
I don't think that explains a whole lot, and the solution I have is just one, there are many.
Good luck and I can help more if needed.
Bill
Pat Barrett
Ranch Hand

Joined: Jan 03, 2001
Posts: 63
I'd have to agree with Bill. I've just turned in my fourth version of this assignment (with extra credit). With each submission I was sure that I had the concepts nailed efficiently, yet each one was sent back with comments that made me approach the solution from an entirely different direction. I've now got four different "working" versions of this assignment that use entirely different approaches.
Having one's code nit-picked, especially outside of a work/school environment is a great learning experience!
Pat B.
Brian Tomlin
Ranch Hand

Joined: Dec 06, 2000
Posts: 31
Thanks Bill, your comments were a tremendous help. I think I understand now what you are doing. I have totally re-written my original version and it is much cleaner and easier to read. I am no longer using charAt(), and I think I'm a better person for it.
I will be submitting it today to the nit-picker for review. I'm sure it's not perfect, and I'm anxious to see what suggestions she may have to help improve it. I must say, this has been a challenging and fun assignment.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question re: Assignment 1.4 Extra Credit
 
Similar Threads
Sorting records
Where's the old object?
Hibernate and JPA
First 10 digits of the sum of 100 50 digit numbers (Project Euler # 13)
Why does SortedSet class has no .get(location) method?