Register FAQ Calendar Search Today's Posts Mark Forums Read

Go Back   Java Programming Forums > Java Programming > New to Java

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 24-09-2008, 03:28 PM
Junior Member
 
Join Date: Sep 2008
Posts: 2
^Son_Gokou08 is on a distinguished road
Default Address book using JAVA

my friend is having a hard time coding an address book using JAVA PL. i want to help her but unfortunately, i dont know anything about that language. so i told her to give the code to me and i'll try to ask around.

Quote:
import javax.swing.*;

public class AddressBook {
public AddressBook() {
}

public static void main(String[] args) {

int addEntry = 0;
int deleteEntry = 0;
int viewEntry = 0;
int exit = 0;

final int MAX_SIZE = 3;
int[] arrOptions = new int[MAX_SIZE];

int userInput = 0;
int flag = 0;

try{
do{
userInput = Integer.parseInt(JOptionPane.showInputDialog("Ente r what you would like to do: \n[0] ==> Add Entry \n[1] ==> Delete Entry \n[2] ==> View all entry \n[3] ==> Exit"));

for (int i = 0; i < arrOptions.length; i++) {
if (userInput == i){
}
}

if (userInput == 0){

String temp = " ";


AddressBookEntry name = new AddressBookEntry();
AddressBookEntry address = new AddressBookEntry();
AddressBookEntry telNum = new AddressBookEntry();
AddressBookEntry eAdd = new AddressBookEntry();

int x = 0;

try{
do{

x++;
if (x<=3){
name.setName(JOptionPane.showInputDialog("Enter a Name"));
address.setAddress(JOptionPane.showInputDialog("En ter Address"));
telNum.setTelNum(Integer.parseInt(JOptionPane.show InputDialog("Enter Tel. Number")));
eAdd.setEAdd(JOptionPane.showInputDialog("Enter E-mail Address"));

temp = temp + "\nEntry number "+x+
"\nName:\t\t\t"+name.getName()+
"\nAddress:\t\t"+address.getAddress()+
"\nTelephone Number:\t"+telNum.getTelNum()+
"\nE-mail Address:\t\t"+eAdd.getEAdd()+"\n";

}

flag = JOptionPane.showConfirmDialog(null, "Would you like to continue?");
}while (flag==0);
if(flag == 1){
userInput = Integer.parseInt(JOptionPane.showInputDialog("Ente r what you would like to do: \n[0] ==> Add Entry \n[1] ==> Delete Entry \n[2] ==> View all entry \n[3] ==> Exit"));


}






}catch(Exception e) {
JOptionPane.showMessageDialog(null, "Error!!!");
}
JOptionPane.showMessageDialog(null, temp);

}
if (userInput == 1){
deleteEntry++;
JOptionPane.showMessageDialog(null, "Please delete add an entry");
}
if (userInput == 2){


}
if (userInput == 3){
System.exit(0);
}

} while (flag == 0);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error!");
}
}
}
Reply With Quote
  #2 (permalink)  
Old 24-09-2008, 03:55 PM
JavaPF's Avatar
Java Programmer
 
Join Date: May 2008
Location: Deep inside the Eclipse IDE
Posts: 172
JavaPF will become famous soon enoughJavaPF will become famous soon enough
Default Re: Address book using JAVA

Hello ^Son_Gokou08 and welcome to the Java Programming Forums.

What problems is your friend having with the code? Is she working to any kind of specifications?
Reply With Quote
  #3 (permalink)  
Old 24-09-2008, 06:23 PM
Junior Member
 
Join Date: Sep 2008
Posts: 2
^Son_Gokou08 is on a distinguished road
Default Re: Address book using JAVA

oopps. sorry for my blunder, i forgot to include this in my post...



Quote:
Create a class AddressBook that can contain 100 entries of AddressBookEntry objects (use the class you created in the first exercise). You should provide the following methods for the address book.

1. Add entry

2. Delete entry

3. View all entries

she's having problem with number 2 (delete entry).
Reply With Quote
  #4 (permalink)  
Old 26-09-2008, 01:15 PM
JavaPF's Avatar
Java Programmer
 
Join Date: May 2008
Location: Deep inside the Eclipse IDE
Posts: 172
JavaPF will become famous soon enoughJavaPF will become famous soon enough
Default Re: Address book using JAVA

Is the code you posted the entire first class?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Custom Search
100 most searched terms
Search Cloud
"bad endpoint type" com.sun.xml.internal.messaging.saaj.soapexceptionimpl com.sun.xml.internal.messaging.saaj.soapexceptionimpl: bad endpoint type com.sun.xml.internal.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception com.sun.xml.internal.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: message send failed com.sun.xml.internal.messaging.saaj.soapexceptionimpl: message send failed com.sun.xml.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception com.sun.xml.messaging.saaj.soapexceptionimpl: java.security.privilegedactionexception: com.sun.xml.messaging.saaj.soapexceptionimpl: message send failed convert arraylist to map date_format_now eclipse shortcut keys ejb3 quartz java convert double to binary java forum java forums java jtextarea bold java jtextarea color java jtextarea font java jtextarea font size java programmer forum java programmers forum java programming forum java programming forums java read last line java read last line of file java sendkeys java.security.privilegedactionexception java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: bad response java.security.privilegedactionexception: com.sun.xml.internal.messaging.saaj.soapexceptionimpl: message send failed java.security.privilegedactionexception: com.sun.xml.messaging.saaj.soapexceptionimpl: message send failed javapf javaprogrammingforums jtextarea bold jtextarea font jtextarea font color jtextarea font size programing forums programming forums reset jcombobox saaj0008 saaj0008: bad response; bad request saaj0008: bad response; not found severe: saaj0008 severe: saaj0008: bad response; bad request severe: saaj0008: bad response; not found soap java.security.privilegedactionexception soapexceptionimpl: bad endpoint type textpad java

All times are GMT. The time now is 12:59 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.