• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Help me in my first project

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am required to implement a program to represent a phonebook. The program is required to handle all the common features of phonebooks such as insertion, deletion, editing and searching.
The program should handle all the following operations
1- Add a new contact
2- Edit an existing contact
3- Delete an existing contact
4- View all existing contacts
5- Search for contacts by First Name, Last Name or Phone Number.
6- Save and Load contacts to and from files. The file format is like the following and you must commit to this format.
i've implemented all of above except finally point i want you explain the concept of writing in files and this what i have done until now

 
Bartender
Posts: 825
5
Python Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags (<- click) when posting your code. That way you will make your code a lot of easier to read and thus increase chances of getting a good answer. I have added them for you this time.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Python Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As for the last part of your task you'll need to show what you have done so far. If you have never implemented reading/writing from/to file, I would suggest you search the official Java tutorial on this topic.

I will take the liberty and comment the rest of your code. It seems ok in some aspects, but do you really want to use first name as an identifier for editing/deleting contact? What if you have two contacts with the same first name, which one will be deleted with your code?

I would also suggest you add toString() method to your Contact class that you could then invoke whenever you want to print information about a contact (which might be useful in viewAllContacts() method).

That search() method also seems a bit strange to me.

You should write a class with a main method, and play with your implementation a little. Also, I must say I don't like seeing no comment(s) in your code...
 
diaa baraka
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks lot for your advices
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic