0
Hi, please help me 😭 i don't know what to do. We need to create contact management system using java language.
Program should ask the user which task he/she wants to do in program:- -Where it can add new contacts including (names, phone number, age, address, email address). -View Contacts -Update Contacts -Delete Contact -Sort Contacts Alphabetically
6 odpowiedzi
+ 1
Yes, if you post your code, I can review. Save it in Sololearn playground and add the link here.
+ 3
Have you tried...
learning a bit of Java first, and writing it yourself?
Create a POJO class to store a single contact with fields, getters and setters.
To easily sort contacts, your class can inherit the Comparable interface.
Then create another "manager" class which can store multiple contacts in a collection, most likely in a List, because you need to be able to change the size dynamically.
+ 1
You have put all the code in the main method. You should at least create a separate method for each functionality.
As I already wrote, it would make sense to create a separate class whose function is only to store data. So instead of having name[] phoneNumber[] age[] and so on, you would have only a Contact[] or even better would be an ArrayList<Contact>
and define the type like
class Contact {
String name;
long phoneNumber;
...(constructor, getters and setters)
}
To make testing of your code easier, provide at least one test scenario (in comment) with all the inputs that must be provided for your program.
0
Yeah , Hmm I tried but I don't think if it's correct, can you help me to correct or complete my code ? because I think my code is wrong .
0
Ok, Thank you so much! ❤️