last day (16 days later) » 
01:00 - 22:0022:00 - 00:00

10:00 PM
@MooingDuck hi. Not sure whether he's attending
I finally got the point to his exercise. I improved on (presumably) your sample a bit: ideone.com/RPXCh
So I'm about to implement addPolynomials for fun, you see :)
 
@sehe I only saw readPolynomial, and when I saw it, it read all the data into the first node. I gave him a tip, so either he did that himself or someone else got him that far.
and some some point yesterday I gave an overview of how addPolynomials should work, but that's lost now
 
@MooingDuck you definitely didn't see 'readPolynomial' (since I just extracted that method). You saw the trainwreck of a main that contained that business. It contained it twice (duplicated) when I saw the code just a while ago.
And there were a number of bugs with that :)
 
@sehe well, it was that functionality. It probably was in main, but I wasn't paying attention to that
 
@MooingDuck Ow. Well. I'm pretty sure I can conjure it up. Dunno whether I should give him the answer when I'm done :)
 
back
There is no reason to sort
In the instruction, it also says this
 
10:11 PM
@user1079641 the part that you failed to quote, then; the same part that also fails to mention about factors always being integral <grin/>
 
also: ideone.com/2thyH compiles
 
all polynomials go from biggest exponenent to smallest one
 
@sehe I don't think it says they're integral, but they assume it from samples and not knowing float.
 
@MooingDuck My friend, that looks like my code?!
@MooingDuck never mind. It is good that we know.
 
can we please use the format I have?
as it becomes very confusing for me to understand
 
10:13 PM
@sehe what?
 
@user1079641 ???! you can use any format you want. I won't
@MooingDuck Why do you say my code compiles. That is a given :)
 
now I can't understand what you are writing in the first place
 
@user1079641 Oh, I can stop
 
@sehe how should I know that? My code never compiles unless I link a compiling ideone link or I otherwise say so :D
 
10:14 PM
@user1079641 If you can't use floats, use doubles!
 
@MooingDuck Oh, I should have mentioned then. I never post my code unless I compiled it (or ideone confirms it ok)
@FredOverflow or decimals, or loopholes. Turns out int is fine (grumble :))
 
@FredOverflow, if scroll a little bit up, you will find word-to-word instructions and can see for yourself how it should be done
 
@user1079641 I starred them, he probably already found them
 
Gents, I don't think you need to bother. Im wrapping this up, and it would be a shame if 3 guys would be doing someone's homework :)
 
it would be if they are doing it
 
10:16 PM
@user1079641 I highly recommend renaming value and value2 to factor and exponent like sehe suggests
@sehe it's either this or do my real work :/
 
You can use file I/O but no floats?!?
 
I am student @FredOverflow, I can't use all this because my prof doesn't allow it yet
see
ok lets do this the easy way
I have taken in one line from the external file
and put the co-efficient and corresponding exponent in link list
now I need to do the same for the second line
 
Ok, I've got it implemented, testing
 
when that is done, i need to take the corresponding parts of polynomials
 
Do you ever have to evaluate the polynomials for certain inputs?
 
10:19 PM
and just add them up if they have the same exponents, else print both of them.
no
 
Oh, you just have to add the polynomials themselves? Then we don't need floats. Where's the problem?
 
the external file has 10 lines and every two lines have same length of polynomials
bringing in the second line into the linked list and then adding up is the problem
 
@user1079641 if you showed a pair of inputs, and an output, that would go a long way to clarification
 
@FredOverflow, look at this: ideone.com/zKbaT
ok here is an example
sample output
 
@user1079641 Why would you be sending them to old, broken code? Nah.
 
10:22 PM
5x^2-9x+7    first line
3x^2+6x+1    second line
8x^2-3x+8    result
 
@sehe that's the best he's got so far
 
2x^4 -5x^3 +9x^2 -10
3x^4 -6x^3 +10x^2 -11
____________________
5x^4 -11x^3 +19x^2 -21
 
Correct?
 
@FredOverflow yes
 
@MooingDuck really. Why am I even posting stuff then
 
10:23 PM
@FredOverflow tricky part is custom linked lists
 
@MooingDuck Okay what is the API for the custom linked list?
 
@sehe your hoping you're helping? I hope it's working :/
 
@MooingDuck are you trolling?
 
@sehe, i appreciate your help, but sometimes I don't understand what you added/removed and so that is why I asked if you would please do it in my format
 
@user1079641 here
@sehe half and half at this point. You said I wasn't needed, I went back to what I'm paid to do
 
10:24 PM
here is the external file:
2x^4 -5x^3 +9x^2 -10x^0
3x^4 -6x^3 +10x^2 -11x^0
-2x^1 +4x^0
2x^1 -4x^0
8x^5 +6x^4 +5x^2 -3x^0
-12x^8 +2x^7 +14x^5
1x^5 +7x^2 +8x^1
-5x^4 -7x^3 -4x^2 -3x^0
10x^5 -3x^3 +4x^2 -234x^1 -12x^0
-5x^5 -2x^3 +10x^0
 
@user1079641 instead, read and try to understand what he posted
 
EVERYONE here who is helping me, I appreciate it...I just posted the external file
 
Wait, is there even a linked list class, or is there just a Node class?
 
@FredOverflow yes. The node is the linked list. Have you never seen homework like this? It's (stupidly) common
 
and I also posted the example
 
10:25 PM
@MooingDuck Answering "yes" to an "A or B" question is not very helpful, albeit funny :)
 
@sehe, once you have your updated code, please share it with me so I can understand what was changed
 
@FredOverflow it's both
@FredOverflow it's a recursive structure
 
@MooingDuck The node class is both a node and a linked list? How retarded is that?
 
@user1079641 See the various links above including the duplicate by MooingDuck. I'm currently testing on your input data ^^
 
@user1079641 he shared it with you several times
@FredOverflow very. It's also sadly common in teaching C++ for some reason.
 
10:27 PM
Where can I see the interface of Node?
 
I can't find the latest copy
ok
i found it
 
@FredOverflow that's it :/
 
Or do we have to write Node ourselves?
 
@FredOverflow wait, I might be mistaken, I think the full list is polynomial or something
 
public class Node {
	int factor;
	int exponent;
	Node next;

	public Node() {
		factor = 0;
		exponent = 0;
		next = null;
	}

	public Node(int factor, int exponent, Node next) {
		this.factor = factor;
		this.exponent = exponent;
		this.next = next;
	}
}
 
10:29 PM
@FredOverflow nevermind, that's all user-numbers has. Sehe actually created a PolynomialList class, but user-numbers hasn't
 
But the Node was delivered with the assigment? Or did user-numbers have to write it himself?
 
@FredOverflow I... don't actually know
 
delivered
 
@user1079641 can you add members?
 
10:31 PM
2 hours ago, by user1079641
here is the latest node class: http://ideone.com/NAGlv
Is it this one?
 
10 mins ago, by user1079641
@FredOverflow, look at this: http://ideone.com/zKbaT
@FredOverflow that's the node, yes. I'd starred that
 
public Object value;
public Object value2;
public Node next;
Objects, seriously? Why?
 
@FredOverflow he doesn't seem to know about int either
 
My teacher wants me to use it...I am sorry if I disappointed you
I can use int
 
10:32 PM
@user1079641 actually... he's storing strings?
 
How can you know Object but not int? And how are you going to add two Objects?
 
I know int
i can do int num = 0;
 
@user1079641 alright, that's good
 
but I haven't learned "float" yet
 
Sure, why use int when you can say Integer.parseInt(someObject.toString())? :)
 
10:33 PM
@user1079641 it's like a int, but holds decimals/fractions, and rounds a bit. (sometimes a lot)
 
@user1079641 IS 0 the only int you are allowed to use? ;)
 
@FredOverflow he's already confused, don't do that :D
 
@MooingDuck float can only hold binary fractions.
 
@FredOverflow I simplified
 
Anyway, no need for floats here.
 
10:34 PM
@FredOverflow eh, true
 
I officially declare my work done. Here it is http://ideone.com/4xfkE
Output:
2  4  -5  3  9  2  -10  0
3  4  -6  3  10  2  -11  0
5  4  -11  3  19  2  -21  0

-2  1  4  0
2  1  -4  0
0  1  0  0

8  5  6  4  5  2  -3  0
-12  8  2  7  14  5
-12  8  2  7  22  5  6  4  5  2  -3  0

1  5  7  2  8  1
-5  4  -7  3  -4  2  -3  0
1  5  -5  4  -7  3  3  2  8  1  -3  0

10  5  -3  3  4  2  -234  1  -12  0
-5  5  -2  3  10  0
5  5  -5  3  4  2  -234  1  -2  0
 
@sehe wow, that's more verbose than I expected.
@user1079641 can you add functions to the node?
 
MessageFormat.format("{0}  {1}  ", ptr.factor, ptr.exponent)
@sehe Cool, I didn't know Java supported C# style (?) formatting.
 
@MooingDuck I opted to not do an OO interface on Node. Mainly, because, well, Node says it all: it doesn't model a list.
@FredOverflow Java 1.5 (5.0) JDK
 
STUPID ME
 
10:37 PM
@MooingDuck: Also, the fact that the links are forward instead of backward made it hard to go through the list in the way I wanted
 
@FredOverflow exponents
 
MessageFormat.format??
 
@user1079641 Just, get rid of that then!? It is like ptr.factor + " " + ptr.exponent
 
It gives me errors when compiling
 
Is your school restricting you to Java 1.4?
 
10:38 PM
@user1079641 Nice. Another random constraint. What JRE version?
 
@sehe I think his node members have different names/types
 
@user1079641 "It gives me errors" is not very helpful for us. At least provide the error messages.
 
@MooingDuck He should probably wake up :) If we can write this code and discuss it at the same time, I suppose he should be able to keep up reading :)
12 mins ago, by sehe
public class Node {
	int factor;
	int exponent;
	Node next;

	public Node() {
		factor = 0;
		exponent = 0;
		next = null;
	}

	public Node(int factor, int exponent, Node next) {
		this.factor = factor;
		this.exponent = exponent;
		this.next = next;
	}
}
@user1079641 reposted my Node.java in case you missed it
 
@sehe I think some amount of time is spent staring in confused horror as his code.
 
I don't really see the point in us solving user-numbers homework. I'm gone. See you in the lounge.
 
10:42 PM
@MooingDuck lol
@user1079641 I'm dumbing the code down to java 1.4
 
@FredOverflow, the intent was to help...he ended up giving me code
 
@user1079641 There, jdk 1.4 compliant Java now: http://ideone.com/4xfkE
@user1079641 Yeah, that was totally accidental :)
 
:)
to be honest
its still not done
 
@user1079641 You just said that wasn't the intent.
3 hours ago, by user1079641
i made those changes, the person who was helping me earlier gave me this code: http://ideone.com/LrNby
2 hours ago, by user1079641
well are you doing anything on the code? if not then tell me and I will seek someone else.
59 mins ago, by user1079641
I just need to get this done
57 mins ago, by user1079641
you there or working on that code?
So.... what is the problem? I can run this baby. And I have shown you the output. Same output now with java 1.4
 
the output has to be with x and ^ exponent
 
10:48 PM
@MooingDuck still there?
@user1079641 Welll... I'm sure you can manage that :)
 
@sehe barely. I'm actually working
 
Something is working here :)
 
well that something requires x and ^
so 5 3 and comes out as 5x^3
:D
 
@user1079641 I'm sure you can manage that, after he gave you everything else
 
@user1079641 Strings maybe? Concatenation? Like, where it now says + " " +
Here is the corrected output. Took me all of 10 seconds to fix the code: Make it 15 seconds because I fixed it to the wrong format first
2x^4 -5x^3 9x^2 -10x^0
3x^4 -6x^3 10x^2 -11x^0
5x^4 -11x^3 19x^2 -21x^0

-2x^1 4x^0
2x^1 -4x^0
0x^1 0x^0

8x^5 6x^4 5x^2 -3x^0
-12x^8 2x^7 14x^5
-12x^8 2x^7 22x^5 6x^4 5x^2 -3x^0

1x^5 7x^2 8x^1
-5x^4 -7x^3 -4x^2 -3x^0
1x^5 -5x^4 -7x^3 3x^2 8x^1 -3x^0

10x^5 -3x^3 4x^2 -234x^1 -12x^0
-5x^5 -2x^3 10x^0
5x^5 -5x^3 4x^2 -234x^1 -2x^0
 
10:52 PM
last but not least i need a ________________________ before result so it shows addition :D
x
x
____
x
there seems to be an error
 
@user1079641 seriously? Sehe is not supposed to be doing your homework for you. You have to know how to do this stuff.
 
@MooingDuck Or learn
 
if the two exponents dont match up, both of of the should printed out
not just the greater one
 
@user1079641 yeah I get it. It keeps amazing me, how you can still come up with additional requirements after posting and starring the full specs. You mean this here: chat.stackoverflow.com/transcript/message/2651315#2651315 ?
That was only half an hour late:
1 hour ago, by user1079641
I am sorry, now that I gave you the word-to-word directions, I don't think there should be anymore problems
 
lol, well i failed
 
11:03 PM
Big time.
On the bright side, you have your first hands-on experience on how not to manage programmers, in case the programming doesn't work out for you (sic)
 
@user1079641 I can't even figure out what this meant
 
@MooingDuck Oh, I can. It is badly worded, but basically they want bookkeeping style, longhanded tabular additions :)
 
@sehe, I appreciate your help but I feel that if I use this code and if my professor asks me what's going on in the code or to explain the code, I won't be able to because I knew exactly what was going on in my format whereas in the format you gave me, I am confused
 
@user1079641 and it would be cheating
 
@user1079641 Then use it as an explanation only. An illustration. Go over it. Steal ideas
get someone to explain it (I'm heading to bed)
 
11:14 PM
@sehe which is learning
 
@user1079641 So you meant something more like this
  +5x^4     -11x^3     +19x^2     -21x^0
  +3x^4      -6x^3     +10x^2     -11x^0
--------------------------------------------
  +5x^4     -11x^3     +19x^2     -21x^0


  +0x^1      +0x^0
  +2x^1      -4x^0
----------------------
  +0x^1      +0x^0


                       +22x^5      +6x^4      +5x^2      -3x^0
 -12x^8      +2x^7     +14x^5
------------------------------------------------------------------
 -12x^8      +2x^7     +22x^5      +6x^4      +5x^2      -3x^0


  +1x^5                            +3x^2      +8x^1
You show me where I can post my answer so I can at least get upvoted :)
 
1
Q: Java Polynomial Addition

user1079641I am using String Tokenizer and Linked Lists, and the Linked Lists are required for this assignment. There is an external file in there are numerous lines of polynomials (one per line). Using String Tokenizers and Linked List, I am running a while loop which captures two lines on each pass and ad...

 
11:33 PM
@user1079641 @MooingDuck @mootinator There. I posted it :) For reference. In fact you might ask for explanations, but for now I'm heading to bed. My alarm goes in 6 hours and there will be lots of coding in my workday, plus the kids and ... life in general :)
0
A: Java Polynomial Addition

seheOk, after lenghty labour in the chat, this is what 'we' came up with. I realize this is just blurting the answer, to an extent. Even so, having a solid implementation in clean style Java 1.4 code could to a lot to help your understanding. There are two files: Node.java class Node { int fa...

 
done
 
@MooingDuck you translate it to Haskell, I'll post a Brainfuck version LOL
@MooingDuck nah, let's swap them :)
 
I'm only proficient in C++, and I'm just starting to slowly learn some Java.
though lolcode has a 1:1 translation to C if I recall
 
@MooingDuck That whole episode just goes to show, that those 'simple' homeworks aren't so innocent as they seem. It requires some real 'getting things done' mentality to do it quickly. Even so, I lost most of my time (2 hours...) battling misconceptions and foggy specs. Realistically though, that's the same thing that the students would be facing, but worse
It also shows me, that going out of your comfort zone (into Java, in this case) will render a programmer helpless quickly (even though this job was limited to the core language).
 
@sehe no, if someone posts a homework question, it's usually because they have no idea where to start or how to do any of the steps, sadly
 
11:43 PM
@MooingDuck And it also serves as a good exercise in keeping the focus: every hesitation / ill chosen path costs disproportionate amounts of time.
 
I will admit one thing
I got past the beginning but had no specific question yet I needed help
In my class, there are many students who face these problems
 
@MooingDuck I was well aware of that. Even so, it took me about an hour, realistically. I doubt whether those profs always realize what they're asking in terms of time. I just hope there is appropriate student guiding/coaching to get them in the right direction :)
 
Honestly, I had visual basic, C#, PHP, and some other programming languages and after that I took a class on Java but others are taking java as their first programming language and its sad that I don't know how to do these things :(
 
@user1079641 That's an opportunity. There will always be the one or two that understand the most, have them explain things at your pace. (I'm too lazy/old :))
 
@sehe no, profs rarely seem to, even at quality schools
 
11:45 PM
@user1079641 Buy them beers and you all benefit
@MooingDuck Then again, I never went to college (well, I switched to Muscial Theory, only to drop that too) but I had been measled by the time I entered highschool.
 
I mean technically, I should be the best one in my class since I am the only one in the class who has programmed in so many other languages
 
@MooingDuck Playing with AMIGA Basic, Turbo Pascal, Borland C++ (ouch) really does help one's constitution and get's you past those initial hurdles in a playful setting. Not with the meter running and no help from the prof.
 
but that is not true
 
@user1079641 Which languages?
@user1079641 So you get to be the guy who gets all the beers. Life is good. Even if it costs you hours, you'll all benefit.
afk
 
Not any high level but in software: VB, C#, very little C/C++ and too little Assembly (lol) and in Web: HTML(obvious), PHP, Ruby on Rails, and a little javascript
 
11:51 PM
@user1079641 you did C#? Then why was this homework so much of a struggle? They're nearly identical!
 
First thing, I don't have any confidence in me in Java. I started learning it last year and have struggled a lot with it so I never gained confidence in me about this language
second, I taught myself all the languages I just listed, I never took a class for them
Java is the first programming language class I am taking
@sehe, I am going to ask just a couple of questions
 
01:00 - 22:0022:00 - 00:00

  last day (16 days later) »