How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask R.R. Jha Your Own Question

R.R. Jha
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience:  B.Tech
Type Your Homework Question Here...
R.R. Jha is online now
A new question is answered every 9 seconds

Hello, I am a computer sciences student and I am working on

This answer was rated:

Hello, I am a computer sciences student and I am working on my program that is due by this the end of this week on Friday. I was wondering if you could take a look at my program and help me finish it. It is an address book and is supposed to be able to create, delete, update, and read contacts (from a txt file) as well as search, & save them all to a text file (the array of contacts). Also, the contacts should be sorted in some fashion, like bubble sorted. Let me know if this is something you could look at & we'll go from there. (Note: I have quite a bit of it done already, so all it would be is to just make sure everything works and then complete a few parts).

Welcome to JA!

I'd be glad to help. Please zip your project, upload it at and post download link here.

Customer: replied 3 years ago.

Hello, I am trying to upload it wikisend and it isnt allowing me to upload an entire folder. Can I post the code below or email it to you?

Please zip the file, and try uploading the zip file at or

We aren't allowed to share personal emails on this forum.
Customer: replied 3 years ago.

Ok, here it is:


That is the source code for the program.



Ok, received it. Let me know the functionality which you've already implemented and those which you would like me to work on.
Customer: replied 3 years ago.

Ok. So far, I have the create, read, and delete working pretty nicely.


I have the method for updating, and the code seems like it should work, but for some reason just isnt.


Also, I made a little interface for the console and my teacher would like us to stick to that. When on the interface, we're supposed to be able to enter 'n' to go to the next entry in the database and 'p' for the previous. I put the methods in the program for that, but they arnt working as well.


Finally, in the program the each contact's info is saved to one location on an array of contacts of the class "Contact". When the program starts, it should begin by reading the file and using those already, pre-existing contacts, in the program. The program should re save the contacts list into the text file from the list which it read from when the program opened. Also, the book should also be able to search contacts (I have the code for searching in the program already, and it works, but I believe that my teacher wants the contacts to be sorted (bubble sorted) by last and then first name.


The code should be at about a high school level and not too difficult or too advanced. Thank you, XXXXX XXXXX know if you have any clarifications you need to make.

Ok, got it. This may take some time. I'll work on this and get back to you tonight or tomorrow morning. Depending on time it takes, you might need to update the price a bit, which I'll let you know if so. I hope that's fine with you.
Customer: replied 3 years ago.

Hi, that sounds good. It would be great if it could be done by tomorrow around 12pm. Thank you very much, this has been a great experience so far on JA.

Ok, Thanks.
Customer: replied 3 years ago.

Hello, just a quick clarification. The language option I chose was JavaScript, because there was not option for java. The program does, however, have to be written in java and not javascript.

Yeah, got that.

I'm almost finished with the program. Made some modifications to previously written methods and added a few more. You may review them and let me know. I hope you can add $20 more after rating the answer. Let me know. I'll post the answer soon.

Customer: replied 3 years ago.

Hello RRJha, that sounds great. Will the program be in full working condition when you are finished? Yes, I wouldn't mind adding an extra $20 when we're all done and its all working. Thank you, XXXXX XXXXX you soon.

Customer: replied 3 years ago.

Oops! Didn't see it posted.

Yes, it's in full working condition. I've tested all user commands. Only that I'm saving only the first and last name to file. You may change that if you wish.

Let me know if I could be of further help.

Please leave a rating for the answer.
Then you can use 'Add Bonus' option to add $20.

Just add 'RRJha' at the start of your new questions to send it directly to me.
Customer: replied 3 years ago.

Hello RRJha, thank you very much. The program looks great and works a lot better! I went through it and I was wondering if you could make a few minor adjustments.


--the progam has problems reading from a file. Because the program only saves the first and last names to a file, when the program goes back into the file to read it, it only reads the first and last names of the contacts. When the user asks the program to show a contact, then only the first and last names are XXXXX XXXXX the rest of the fields are blank. Could you have all the fields saved and read?


-- for displaying contacts: remove the "list all contacts" command and then make a "show contacts" command instead. In this command make it show the first contact and then from there we would then have the option to go to a previous or next contact.


--when updating a contact, the program should just go to the save all data method, it should not have to ask to the user to save the data. However, it should ask if he or she wants to over write it.


--when searching a for a contact, the search shouldnt be case sensitive. If the contact was entered as "John Doe" and the user searched john doe, that contact should come up.


--for listing contacts, could you think of a more creative way to list them (i.e. include all their info somehow in a short way so that it doesnt take up too many lines). I think that might make the program just that much better!

Thank you, XXXXX XXXXX you soon.

Ok, updating it.
Customer: replied 3 years ago.

I made a couple of changes to it for a little head start:


You need to spend $3 to view this post. Add Funds to your account and buy credits.
R.R. Jha and 3 other Homework Specialists are ready to help you
Customer: replied 3 years ago.

Hello, that is absolutely amazing, I am very happy with the help! Just one last thing, do you think that it would be possible to implement this as a write to a file method and still be able to read from it?:

private static void WriteData() {
switch (DecideIfToWrite()) {
case 'y':
try {
File f = new File("stuff.txt");
if (!f.exists()) {
FileWriter file = new FileWriter("stuff.txt");
BufferedWriter wbuff = new BufferedWriter(file);
wbuff.write("Current Contacts in the Address Book:");
for (int i = 0; i < ncontacts; i++) {
wbuff.write("Contact #: " + i + "\n");
wbuff.write("First Name: " + contactArray.getFirstName());
wbuff.write("Last Name : " + contactArray.getLastName());
wbuff.write("Address #1: " + contactArray.getAddress1());
wbuff.write("Address #2: " + contactArray.getAddress2());
wbuff.write("City : " + contactArray.getCity());
wbuff.write("Province : " + contactArray.getProvince());
wbuff.write("Postal : " + contactArray.getPostal());
} catch (IOException e) {
System.out.println("All data was successfully written.\n");
case 'n':

Yes, it can be done. But then the read method would be much more complex than what currently is. So, I'd suggest that we stay with our current methods.
Customer: replied 3 years ago.

How much more complex? Do you think that it would make the program look a bit nicer? (or the file rather).

To be honest, I think current format is what the standard database file looks like. Because we already know the name and position of each field. All common fields are listed under one column, instead of each individual field carrying separate but redundant tag.
Customer: replied 3 years ago.

Ah I see, ok. I'm just going to do a bit more testing and then we should be done! Thank you for all of your help today, it has been much appreciated. Your service has been excellent and of very high quality. I will reply here if I have any further clarifications to make.

Please leave a rating for the answer when all done. Would look forward to bonus as well.


Related Homework Questions