Ahhh I forgot to do it in the second one! That fixed it! Everything looks like it works now, I will post again if I have another problem! Thanks a ton!
Type: Posts; User: Saintroi
Ahhh I forgot to do it in the second one! That fixed it! Everything looks like it works now, I will post again if I have another problem! Thanks a ton!
And after changing that, it does, in fact, get past that error. However, another one does occur.
"java.lang.StringIndexOutOfBoundsException: String index out of range: 6926
at...
Hmm.. it might mean that. I guess i'll take the numbers out? And no, I dont need to count the numbers, just letters.
Great help! Turns out it ended up being a number! But that doesnt make sense to me because this should have removed numbers:
public String getFile()
{
return...
Also, could you tell me why it is not printing to a file like it should? It makes the file, but its empty.
Using this tester.
import java.text.*;
import java.util.*;
import java.io.*;...
Hmmm.. after changing that it seems to work alright with the small file, however with the bigger one I get an error:
java.lang.ArrayIndexOutOfBoundsException: -48
at...
Aha! I see, so by the looks of that its skipping every other one with calculating percent, because of:
public void setPercent()
{
for (int c = 0; c < 26; c++)
{
percent[c]...
I chose to go the route of setting up that method as setOccurance() and making it void and using a getOccurance() method to return it to print. That works fine, at least it seems to. The problem...
*Facepalm* That was a dumb mistake. Thanks! I didnt realize what was going on there!
Thats confusing... I only call getOccurance() once, and the elements should only be getting incremented when they match the char that c is set as. Thats what [c - 'a'] does, correct?
Welllllll I ran into an issue :/ It's not counting right. I get like 114 s's when there is only 59 letters, and that doesnt make sense to me. Ill post the code. You'll see that I've also added...
Thank you soooooo much! It works perfect now! You have taught me a lot with this! Much love! <3
Alright, well i'll start by saying that I tried to write this program once before, when I ran into problems, my instructor advised me to rewrite the entire program. So I did. And I made it much...
Wow, that makes a lotttt of sense! Thanks for the help! I attempted what you suggested, and I think I did it right, however I now get an error when trying to make a substring of the string. I have no...
Alright, I edited it. I did test the methods prior to posting. The countLetters() method is not relevant to this part of the code, but I included it anyway as to prepare for what I have to do when I...
So, ive had this problem before, but I cant seem to find the culprit this time. Its a really large project I have to do and I'm stuck on the first part. So for now, we'll just say that all its...