Donovan Smith wrote:When I run the program with either =+ or += the results are the same and makes no difference plus the complier doesn't count it as an error.
How you proved it that to yourself?Donovan Smith wrote:for now the program does what I wanted it to do
Donovan Smith wrote:For the last time the flavor was just an analogy. The Users could enter "Red" "Blue" "Green" or "Crack" "Snackle" "Pop." Creating a method for flavors would be pointless. Because the string content itself doesn't matter as far as the logic goes. Only time the content matters is when I ask the user which one they like best? Far as the program is concerned it "Red" vs "Blue" might as well be "wingbats" vs "fogglehorns."
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Donovan Smith wrote:For the last time the flavor was just an analogy. The Users could enter "Red" "Blue" "Green" or "Crack" "Snackle" "Pop." Creating a method for flavors would be pointless. Because the string content itself doesn't matter as far as the logic goes. Only time the content matters is when I ask the user which one they like best? Far as the program is concerned it "Red" vs "Blue" might as well be "wingbats" vs "fogglehorns."
OK, but it's a fairly laborious process, isn't it? Fine if you only have three things to worry about; but what about 4 or 5 or 10? Might it not be simpler to simply assign each "item" a value, and then sort or filter based on that?
And have you actually tested your program with any more than 3 items?
Winston
Liutauras Vilda wrote:Here you checking strings if i'm not mistaken, strings shouldn't be checked for equality like this, unless you want to check if references refer to the same memory location. Check if your intense is that.
Code is very difficult to read, but I think you checking the same elements as many times as inner for loop iterates. Check if your intense is that, as i'm not sure. I mean this part:
In the code line below you confusing your reader by naming array size as ListSize, which is not a List.
Well, I have to admit, not much I understand from your code what you want to do in general, even tho task sounds simple.
Liutauras Vilda wrote:Once again, are you sure you want to check references here?
And as I mentioned earlier, I think you'll do the same check many times because of your inner loop. In different words you'll ask the same persone the same question what do you prefer A or B as many times as comparisonsToMake big is, is it what you want?
I was refering to different thing. I mentioned twice that you're checking "text" != "text" is it what you want? Strings equality suppose to be checked "text".equals("text").Donovan Smith wrote:That Error has been fixed for awhile now....
That is probably even more worse then. And I mentioned that twice too. Your inner loop for does not advance element position, so you're asking user which thing they do prefer more more than one time. Maybe it is your intention, I don't know that.Donovan Smith wrote:I reposted the updated code awhile back and solved that problem. [z + 1] is now [y + 1]
Liutauras Vilda wrote:
I was refering to different thing. I mentioned twice that you're checking "text" != "text" is it what you want? Strings equality suppose to be checked "text".equals("text").Donovan Smith wrote:That Error has been fixed for awhile now....
That is probably even more worse then. And I mentioned that twice too. Your inner loop for does not advance element position, so you're asking user which thing they do prefer more more than one time. Maybe it is your intention, I don't know that.Donovan Smith wrote:I reposted the updated code awhile back and solved that problem. [z + 1] is now [y + 1]
Donovan Smith wrote:You seem to be assuming that I or the user should know before hand the value of each object. If I did I wouldn't need to ask the user to choice between any given pair of elements in the array.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:TBH, I'm not wild about that solution either...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Donovan Smith wrote:You seem to be assuming that I or the user should know before hand the value of each object. If I did I wouldn't need to ask the user to choice between any given pair of elements in the array.
No, I'm not questioning the requirement, merely the methodology; in the same way that I would question the use of a bubble-sort instead of a quicksort.
Given that your program is going to take an awfully long time to run for even as little as a "Top 5" list, what about this (for a "Top X" list):
1. Get the first X items to be ranked.
2. List them on the screen and ask the user to rank each one with a number (and suggest they leave gaps). That could probably be done with a single entry, but doesn't have to be.
3. See if they want to add any more items.
4, If so: [Loop until they've entered them all]
a. Get the item.
b. Ask them for a number that ranks that item relative to the others listed - and if they want to add a new item between two adjacent ranks (say 23 and 24), allow them to enter 23.5 (or as many decimal points as its takes - ie, make that "rank" value a double or a BigDecimal).
TBH, I'm not wild about that solution either; but it was the best I could come up with at short notice.
And it doesn't require my user to answer 55 "Do you prefer A or B" questions (at the very least) to get a "Top 10 list".![]()
Winston
Donovan Smith wrote:Here is the thing. You could make a list that way, problem is I try to make a list that way all the time without a program because I keep backtracking and being indecisive. Because I'm trying to rank one in relation to the whole...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Donovan Smith wrote:Here is the thing. You could make a list that way, problem is I try to make a list that way all the time without a program because I keep backtracking and being indecisive. Because I'm trying to rank one in relation to the whole...
I think I understand what you're saying. It's like trying to make a list of your 10 favourite films from all the ones you've ever seen. So you make a list (that would probably take me days), and then work out that you've missed out "Casablanca" - which would definitely be either #1 or #2 for me.
Am I on the right lines here?
OK, well consider this. Forget my first "solution" (way too overthought) and look at my last post instead. It's much simpler, and at each stage you only have ONE item to deal with.
So, let's say I've worked really hard and wittled my "favourite film" list down to 10: Schindler's List, Alien, The Godfather, Die Hard, MASH, 2001, Gandhi, Shawshank, Citizen Kane, and Casablanca.
But now I need to wittle that down to a "Top three".
The first one (in random order) is "Schindler's List", so I put it up:
1. Schindler's List.
The second is "Alien", so I only have one decision - is "Alien" better than "Schindler's List"? Answer: no (YMMV), so I get:
1. Schindler's List.
2. Alien.
The next is "The Godfather", so I now have to decide where it ranks, so I get:
1. The Godfather.
2. Schindler's List.
3. Alien.
The next is "Die Hard,", so I now have to decide where it ranks, but this time, I have to lose a title (top 3, remember). Result:
1. The Godfather.
2. Die Hard.
3. Schindler's List.
The next is "MASH" which, good though it is, can't change my top 3
...
and so on and so on, down to "Casablanca", at which point my list looks like this:
1. Shawshank.
2. 2001.
3. The Godfather.
Well sorry guys, but Bogie's gotta be in there, so I end up with:
1. Shawshank.
2. Casablanca.
3. 2001.
And you know what, that's a pretty good "Top 3" (for me).
And the reason it's good is that at every stage I've limited the number of choices I have to make.
And I did it with 9 decisions. not 55.
Hope it helps.
Winston
PS: And incidentally, the rest of that list would be: #4:The Godfather, #5:Gandhi, #6:Die Hard, #7:Schindler's List, #8:Citizen Kane, #9:MASH and #10:Alien.
Winston most certainly does get it.Donovan Smith wrote:. . .
No actually you don't get it.
Not at all. Comparing successive items in a List is very easy if you have the right tools in place. I told you where you can find out about such tools on Tuesday. The slightly complicated part of Winston's suggestion is collecting the preferences. That is a bit like collecting scores in a football league, where each win can move a team higher up the league. Once those data are collected, the sorting can be quite simple.. . . compare each item on the list to another item but in real life this would be tedious. . . .
You have ended up with convoluted code which nobody can read, and a solution which looks as though it cannot be extended.. . . So yeah for my purposes my way way is better, and I don't mind going through 55 decisions, in truth the thoroughness makes me feel better, like I didn't miss anything.