posted 17 years ago
Hi im trying to solve this problem:
You have two list of numbers.
The size of the list is larger than 5, but smaller than 20. The numbers in the lists are not sorted; a number can appear more than once in a list. Examples of such lists are [1,2,3,4,5,6,7,8,9,10,11,12] and [1,2,3,5,7,9,11]
I am to write a class NumberListApplication that contains only a main method. The main method will construct two NumberList-objects and store the numbers from your lists into the two NumberList-objects. Then a third NumberList-object is constructed that contains the numbers from the first list that are not part of the second list.
Explanation: if the contents of the two lists are [1,2,3,4,5,6,7,8,9,10,11,12] and [1,2,3,5,7,9,11], the contents of the new list will be [4,6,8,10,12] or a permutation of this.
I have written the classes and they are fine..my problem lies in generating the third list. My major problems are:
1. I need to know the size of the new list to be generated..so that i can create a numberlist object..with the size of the list as a parameter.
2.I have problems with generating the third list...any ideas...sample code would really help.
"Human beings can alter their lives by altering their state of mind" William James