Results 1 to 2 of 2
Thread: Count on cantor help!?
- 04-06-2009, 12:39 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 1
- Rep Power
- 0
Count on cantor help!?
I need some help coming up with the correct coding for the count on cantor problem. You can read an explanation of the problem in here:
The only difference is that I have to read the number from a file (already did it) and it does work that way, BUT I also have to calculate the sum of all terms before that number.Java Code:werdna1222coldcodes.blogspot.com/2008/10/264-count-on-cantor.html
Example:
3 is 2/1 - Sum: 2 1/2
14 is 2/4 - Sum: 22 3/4
I'm using a class named Racional, which I call from this problem to set the numerator and denominator of my number, and after that I call the sum method (also in my racional class). I can't seem to find the problem, but when I run the program it shows an error regarding my sum method. I did a somewhat similar code and the sum does work but not in the right way.
Here's my racional class
And my codeJava Code:fileden.com/files/2007/4/15/987298/PruebaRacional.java
I put a link to the files since they are quite long.Java Code:fileden.com/files/2007/4/15/987298/Tarea412.java
I would really appreciate it if someone could help me!
- 04-06-2009, 06:22 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
have you found any Strange in the for loopJava Code:for (int t = 0; t < n.length; t++) { // code }
what if the text file only contain 3 numbers, how many times do the looping should do? is 3, not n.length
Similar Threads
-
to get count value as a variable
By arunkumarinfo in forum JDBCReplies: 2Last Post: 03-30-2009, 01:32 AM -
post count
By codeflip in forum Forum LobbyReplies: 2Last Post: 03-12-2009, 02:20 AM -
Getting row count
By Java Tip in forum Java TipReplies: 0Last Post: 02-11-2008, 08:49 AM -
how to count 2 inserts together?
By kim85 in forum New To JavaReplies: 0Last Post: 01-20-2008, 11:25 AM -
Getting row count from executeQuery()
By Java Tip in forum Java TipReplies: 0Last Post: 12-05-2007, 02:31 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks