Hi, I've read the rules for this website and i'm aware that we should not expect people to do our homework. But I really need help on this program.. and I'm not sure how to start it, and it's last minute help please.

I'm suppose to do this using sorting algorithm..so it asks to creat a friends database application that maintains a file of friend objects that contain names, telephone numberrs, and email adresses..etc. The friends application should load friend records from a file and then allow the user to add new friends, delete friends, display a list of all friends by either first naem or last name, and search for a friend. Well the output should look something like this:

1. add a friend
2. display a friends by last name
3. display a friends by first name
4. find a friend
5. delete a friend
6. quit.

Yea.. 've been trying to at least find some examples that are similar to this type of program.. but I didn't really find any. So any help, or similar type of examples/codes for me. thank you!

Recommended Answers

All 9 Replies

hi dear , what kind of help do you need? tell me to the specific so that i can try to help.

If you search this forum you will find examples on how to:
> Read a file
> Write to a file
> Use the split method
> Create objects
> Add them to Vector or ArrayList

And to make things simpler, don't try to put everything in the main method. Try to separate them in different methods

Edit:
There is also an example on how to create a menu using an endless while loop

hi dear , what kind of help do you need? tell me to the specific so that i can try to help.

Okay, i haven't started coding yet...but can you tell me the code how i can prompt the user to enter names, and than put them in alphabetical order and outputs them using sorting, thats it. thanks

Hi, I assume this is a console based application.

Try using Scanner scanner = new Scanner(System.in);

Then String line = scanner.readLine() will read in the line entered.

Then perhaps Collections.sort(list) will sort a list of objects for you.

Thats probably the easiest thing to do.

Okay, i haven't started coding yet...but can you tell me the code how i can prompt the user to enter names, and than put them in alphabetical order and outputs them using sorting, thats it. thanks

You will find plenty of examples in this forum on how to use the Scanner class.
Also check the API for the Vector or ArrayList for storing the input.

If Scanner class doesn't work, post the errors you are getting, because it works for java 1.5 .

you can also use the GUI java's facility by importing the javax.swing
this liabrary function has two dialog windows used for accepting input and providing output.
it is easy to use . try it.
import javax.swing.JoptionPane;
string name=JoptionPane.showInputDialog("Enter your Name");
JoptionPane.showmessageDialog("Type Your message Here");
i think it is easy.

Have you even bothered to start writing a "Friend" class yet? Started with a basic input loop perhaps? Or are you just sitting there waiting on someone to write all of this for you?

Your first post said it was urgent, yet 2 days later you haven't started? You may have read the rules about homework, but you certainly didn't understand them.

Have you even bothered to start writing a "Friend" class yet? Started with a basic input loop perhaps? Or are you just sitting there waiting on someone to write all of this for you?

Your first post said it was urgent, yet 2 days later you haven't started? You may have read the rules about homework, but you certainly didn't understand them.

It is urgent, because I don't want to start worrying on the day before its due and be like "i don't know where to start". I've started it... but i'm not gonna post it yet because there are still some fixing to do. If you read my other comments, i specified what my question was. I obviously don't expect someone to write it all out for me. It'll be like 4 files, who would put such effort to do that much.. your definitely not one, your not even helping. I'm not stupid enough to think someone would write this for me.

Edit:
There is also an example on how to create a menu using an endless while loop

Where can I find that thread/article?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.