I have to create a java file to do
Write a class Entry which represents entries in a telephone directory. Each entry consists of a name an address a telephone number
Represent all three items as single strings.
Provide appropriate constructors and methods for this class. This will involve providing getters and setters for each instance variable as well as a toString() method.public class Entry { String name; String address; String telNo; . . . }
I have NO clue what I am doing! And this is what I have so far!
public class Entry { public static void main(String[] args){ Entry e = new Entry("Corky", "DH 3104", "x 6042"); e.getName(); e.getAddress(); e.getPhone(); /* fields */ String name; String address; String phone; /* constructor */ Entry(String n, String a, String p) { this.name = n; this.address = a; this.phone = p; } /* accessors */ String getName() { return this.name; } String getAddress() { return this.address; } String getPhone() { return this.phone; } }