POST DELETED
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
POST DELETED
Last edited by sensoryctascale; April 21st, 2011 at 04:57 PM.
HI,
I notice that there are two of you with the same assignment.
//…Stuff System.out.println("Enter values for first set, ending with -1"); String firstSet = new String(); String secondSet = new String(); int setA = input.nextInt(); int setB = input.nextInt(); while (setA != -1) { setA = input.nextInt(); if (setA != -1) firstSet = firstSet + setA + " "; } //OTHER STUFF…
Think about the order that this is doing things.
What happens when you enter these values for the first set?
-1 -1 2 3 4 5 6 7 8 9
What happens when you enter these values for the first set?
1 -1 2 3 4 5 6 7 8 9
Can you see where the first two value are 'disappearing' now?
Also as a side note make sure you post in the correct section. I'm not sure how strict this forum is (my first time/post) but some forums can get pretty touchy about such things.
Suisse
What are these 2 lines for? Currently you read the first 2 numbers into these variables and then throw them away.int setA = input.nextInt(); int setB = input.nextInt();
I think i've been told you in the form of pseudocode on another thread in What's Wrong with my Code? Forum. Go and search there...