reset password
Author Message
dliang
Posts: 35
Posted 16:38 Sep 07, 2019 |

Does anyone know why we should have an integer variable in the methods? 

existsInSet: This method shall be a public method which accepts one integer as an argument.  This method shall return true or false depending on whether or not the given value already exists within your set.  You will want to implement this method first since it will help you to implement some of the methods to follow.

There are no other data fields require for our class, we only have an integer of the array(set). So what is that for? 

rchatte
Posts: 5
Posted 16:42 Sep 07, 2019 |

Yes the integer the method existsInSet(int value) is the int that you are checking for in the array. if the int does exist in the array the method should return a true Boolean if not then it will return false.

kknaur
Posts: 540
Posted 17:10 Sep 07, 2019 |
rchatte wrote:

Yes the integer the method existsInSet(int value) is the int that you are checking for in the array. if the int does exist in the array the method should return a true Boolean if not then it will return false.

This is correct.  Remember, even though your class only has one data field, you may need additional data that can come into one of the class methods through the method parameter.  Generally if a direction says the method will accept or will take a value this refers to data coming into the method through the method parameters.  If a direction says that a method will return such and such a value...well then it returns a value. 

The directions don't explicitly state the method headers, return types, parameters, etc... because I want you to think through the problem very logically and try to come up with the correct method syntax based on the clues in the directions.

dliang
Posts: 35
Posted 02:42 Sep 14, 2019 |

Professor Knnaur

Just to make sure, that we were not allowed to use HashSet, TreeSet, and ArrayList to remove duplicates?

kknaur
Posts: 540
Posted 14:29 Sep 14, 2019 |
dliang wrote:

Professor Knnaur

Just to make sure, that we were not allowed to use HashSet, TreeSet, and ArrayList to remove duplicates?

You are not allowed to use these.  If you do, you will get no credit for the assignment.