import java.io.*; import java.text.DecimalFormat; public class AddressBook{ public AddressBook(){ } DecimalFormat al = new DecimalFormat("#.##"); private String name=""; private String address=""; private int telephone; private String email; private String att; public static void main( String[] args ){ DecimalFormat al = new DecimalFormat("#.##"); AddressBook aBook = new AddressBook(); AddressBook bBook = new AddressBook(); AddressBook cBook = new AddressBook(); aBook.setName("Boy Katay"); bBook.setName("Kris Manginum"); cBook.setName("Ronald Spades"); aBook.setAddress("123 SlaughterHouse"); bBook.setAddress("26 Assumption Road"); cBook.setAddress("89 Casino Avenue"); aBook.setTelephone(4246512); bBook.setTelephone(4421231); cBook.setTelephone(6201130); aBook.setEmail("Katay@yahoo.com"); bBook.setEmail("Arak@gmail.com"); cBook.setEmail("Pusoy@hotmail.com"); aBook.setAtt("Student"); bBook.setAtt("Student"); cBook.setAtt("Student"); System.out.println( "Attributes/Properties :"+aBook.getAtt()+ "\nStudent Name :"+aBook.getName()+ "\nnAddress :"+aBook.getAddress()+ "\nTelephone :"+aBook.getTelephone()+ "\nEmail :"+aBook.getEmail()+ "\n\nAttributes/Properties :"+bBook.getAtt()+ "\nStudent Name :"+bBook.getName()+ "\nAddress :"+bBook.getAddress()+ "\nTelephone :"+bBook.getTelephone()+ "\nEmail :"+bBook.getEmail()+ "\n\nAttributes/Properties :"+cBook.getAtt()+ "\nStudent Name :"+cBook.getName()+ "\nAddress :"+cBook.getAddress()+ "\nTelephone :"+cBook.getTelephone()+ "\nEmail :"+cBook.getEmail()); } public String getName(){ return name; } public void setName( String name ){ this.name = name; } public String getAddress(){ return address; } public void setAddress( String address ){ this.address = address; } public int getTelephone(){ return telephone; } public void setTelephone( int telephone ){ this.telephone = telephone; } public String getEmail(){ return email; } public void setEmail( String email){ this.email= email; } public String getAtt(){ return att; } public void setAtt( String att){ this.att= att; } }
How can I make this code so that I can create a class address book that can contain 50 entries of AddressBookEntry objects (using the code above). And it should provide the following methods for the address book.
1. Add entry
2. Delete entry
3. View all entries
4. Update an entry