George Avilez

Ranch Hand
+ Follow
since Apr 26, 2013
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
7
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by George Avilez

Here is line counter if the problem might be here...

10 years ago
Line 55-58 I just added the following and it worked like a charm:



I don't think line 5 was necessary though
10 years ago
When the user chooses the viewList method (lines 73-84) and then presses deleteItem method right after (lines 1-71), the error at line 45 happens, stating what it says on that line. If the user never touches the view choice then the code will work perfectly fine and the user can keep on deleting items and keep entering invalid items all day. It isn't until the user presses the view choice, then that deleteItem method is just worthless and all they can really do next is create a new list or exit the program. can anybody help? I believe it has to do with the boolean because the new temp file shows the list with the deleted item, it's just not renaming the new temp file and deleting the old one so obviously the deleting item part is working bu not the boolean

10 years ago
When I have the user on the main menu choose (they can choose this option and any other option until they quit the program) to delete an item off the text file, the code will work perfectly and delete as many items as they want(lines 38-53). If the user enters an item that is not on the list, it will work fine (line 57) and let the user know that the item was not found and send them back to the menu. The problem I'm having is after the wrong input, if they choose to put in another item after an invalid entry, then the program won't delete the old list and rename the new list. I'll look back at the directory and the new temp file is saved but not renamed and the old file I wanted deleted is still there. So it obviously works but the Boolean is acting up. I tried to be as clear as possible, please let me know if you need more clarity. Hope you can help thanks.

10 years ago

It's your logic. You turn smile and frown to true when the button is pushed but never change them to false when the other button is pushed. Then you paint them both every time. So the frown, once true is always true and the smile, once true, is always true and then you paint them one after the other. I haven't run the program, I just eyeballed it. See if that's not the problem. If it isn't , come back and I'll look more closely.



Thanks bro, worked like a charm!
10 years ago
The wink and frown button work, but when I press the smile button the face keeps the smile and the frown. ANy idea why?

10 years ago
I'am so dumb haha =p I just put "lines = 0;" at the end of each method and everything went smoothly haha. I got it solved thanks guys!
10 years ago
If you guys don't mind helping, I know what is causing it but now don't know how to approach it. Assuming I enter case 3 twice(easy way to test out since it is just viewing the file), that error pops up. I noticed when line 18 prints out how many lines there are on the first entry, it is correct (in this case there are two lines). But on the second entry line 18 prints out 4, which is why I get that error I believe, because now it doesn't even show my list. I guess the lines doubles and that created some problems. Anybody have some suggestions on how to bypass this error? If not it's fine, just let me know if it's something I would have to really debug further into

BTW the error is at line 23

10 years ago
Thanks guys, it worked but now I'm getting dumb noSuchElement Exception errors I think on my arrays in some of the methods when I enter a second case (EX: choosing case 3 then case 4 when looped) =/ haha it's always one thing after another, I swear I get the worst luck. Thanks though you guys helped me get one of the parts down.
10 years ago

You absolutely need a different loop if you want to repeatedly ask for an entry until you get one that is found. You can't do it with the one you currently have as that just loops over the lines in the file and for each user entry you need to repeat this process.



Thank you, this one makes sense to me and was basically what I was asking earlier when I asked:

Or are you saying I should create another while loop just to check if the user input is available?



Thanks for the help
10 years ago
Yeah true. SO Am I better off just making a different while loop with an if/else that focuses on whether the input could be found on the txt file? Then break out of it if there was on found and take it straight to the while loop I have?
10 years ago
Well what the code is doing right now is asking for a user input, then the code will grab all the strings from the txt file and compare the users input with each string/line from the txt file. If there is a match then that string is deleted off the file. This works perfectly, but I want the code to also let the user know that there is no match in case the user enters an input that doesn't match with anything. ANd possibly loop them back to re-enter an input. As of right now if they enter an input that doesn't match then the program will still end correctly but no changes are made to the file.
10 years ago
It's not much of help sry. I know how to use if/else. Like I said the continue is throwing everything off for me, that if/else DOES work if there is no continue. There is no examples out there to show what to do after with that continue, unless I missed it. That's all I'm asking, first time using that value so idk how to properly syntax it...
10 years ago