reset password
Author Message
knagrec2
Posts: 51
Posted 20:46 Oct 14, 2018 |

Can we just combine them? In my implementation, they are very similar, so I could combine them quite easily and just check whether the user had wanted to delete or simply find. The menu system would be exactly the same, I just wouldn't have a deletePerson method.

rgallegos
Posts: 29
Posted 23:44 Oct 14, 2018 |

We had a similar question for the addPerson function and the answer received was pretty open to interpretation. Since we just covered Abstraction and all the other pillars, it seems to make sense that if we can write one function that's private or does something without the user having to know how it works then it would be okay to implement it in our programs. I have a bunch of small methods that take care of little things. I had a similar idea to create the find method first but created two separate codes for it.
If you managed to do it, then more power to you.

rgallegos
Posts: 29
Posted 23:44 Oct 14, 2018 |

I don't know how it double posted.

Last edited by rgallegos at 23:45 Oct 14, 2018.
kknaur
Posts: 540
Posted 07:07 Oct 15, 2018 |

You should have both. One method's job is to locate a Person and their information, the other is to find and delete a Person and their information. 

 

Nothing says you can't use your find function to help implement your delete function. With any data structure find and delete are always separate functions. Look at a Stack with its peek and pop functions or ArrayList with its find and remove functions.

Last edited by kknaur at 07:08 Oct 15, 2018.