Results 1 to 16 of 16
Thread: AddEntry in Java..
- 12-15-2009, 04:34 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 75
- Rep Power
- 0
- 12-15-2009, 04:50 PM #2
Ahem? What? I'm totally lost on what you are trying to do and what your question is, some context would be helpful.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 12-15-2009, 05:06 PM #3
Member
- Join Date
- Nov 2009
- Posts
- 75
- Rep Power
- 0
hey PhHein this is the code stub i have to work off. this is new to me the addEntry() method, and the others too.. a bit of direction would be great. thanx
Java Code:public class Directory { private static final int NO_ENTRIES = 100; Entry[] theDirectory = new Entry[NO_ENTRIES]; // add an entry to theDirectory // if theDirectory is full do not add the entry public void add(Entry anEntry) { } // deletes an existing entry public void delete(String nameToDelete) { } // change the number of an existing entry public void change(String name, String newTelNo) { } // finds and returns the number for the search name public String find(String searchName) { } // returns the entire directory as a String public String toString() { } }
- 12-15-2009, 05:25 PM #4
Wow. Did you get that or did you implement that yourself? If you implemented that yourself, I'd suggest some major changes.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 12-15-2009, 05:26 PM #5
Member
- Join Date
- Nov 2009
- Posts
- 75
- Rep Power
- 0
i was given that to work off. coudl you be of any help to point me in the right direction. ive been looking at the java api but no luck, do u have any other websites you could advise?
- 12-15-2009, 05:31 PM #6
You need these two:
Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
Strings (The Java™ Tutorials > Learning the Java Language > Numbers and Strings)
Start off with the last two mehods, as you'll need them for the other methods.
I'm out for today, will check tomorrow.
PhilMath problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 12-15-2009, 05:33 PM #7
Member
- Join Date
- Nov 2009
- Posts
- 75
- Rep Power
- 0
Cheers Phil.. much appreciated
-
It seems to me that this has nothing to do with looking stuff up in the API and all to do with the most basic array handling code. Do you understand arrays fully? If not, what are you having trouble with?
- 12-15-2009, 07:04 PM #9
Member
- Join Date
- Nov 2009
- Location
- SRI LANKA
- Posts
- 3
- Rep Power
- 0
public void addEntry(java.lang.String name,
java.lang.String s)
throws java.io.IOException
Throws:
java.io.IOException
- 12-16-2009, 08:24 AM #10
WTF!!? :confused:
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 12-16-2009, 09:09 AM #11
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,397
- Blog Entries
- 7
- Rep Power
- 17
- 12-17-2009, 02:50 PM #12
Member
- Join Date
- Nov 2009
- Posts
- 75
- Rep Power
- 0
hey guys ive made an attempt on this part could anyone tell me if im going in the right direction??
Java Code:import java.io.IOException; public class Directory { private static final int NO_ENTRIES = 100; Entry[] theDirectory = new Entry[NO_ENTRIES]; // add an entry to theDirectory // if theDirectory is full do not add the entry public void addEntry(Directory entry) { Directory newSection; if (entry < NO_ENTRIES) Entry.addEntry(entry); return; }
- 12-17-2009, 02:54 PM #13
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,397
- Blog Entries
- 7
- Rep Power
- 17
Shouldn't you store something in your array theDirectory and you should increment a counter variable if you add something to your array. It would be quite convenient if the method returned something that indicates whether or not an entry was added to the array. Oh, and you don't use that local variable newSection at all so why define it? btw, by convention all variables start with a lower case letter. Is addEntry( ... ) a static method or not? IMHO your code snippet is a mess.
kind regards,
JosLast edited by JosAH; 12-17-2009 at 02:58 PM.
- 12-17-2009, 03:01 PM #14
Member
- Join Date
- Nov 2009
- Posts
- 75
- Rep Power
- 0
JosAH thanks for the speedy reply, im new to java and in many cases all is a new field to myself. any hints on how i could make it easier for myself would be appreciated?? any good websites that i could posibly learn from? ive been doin java for the past 2 months
- 12-17-2009, 03:07 PM #15
The List™:
Sun's basic Java tutorial
Sun's New To Java Center
Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
jGuru
A general Java resource site. Includes FAQs, forums, courses, more.
JavaRanch
To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
Yawmarks List
The Java Developers Almanac
Java Examples from The Java Developers Almanac 1.4
Bruce Eckel's Thinking in Java(Available online.)
Joshua Bloch's Effective Java
Bert Bates and Kathy Sierra's Head First Java
James Gosling's The Java Programming Language
Gosling is the creator of Java. It doesn't get much more authoritative than this.
Joshua Bloch and Neal Gafter Java Puzzlers.Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 12-17-2009, 03:24 PM #16
Member
- Join Date
- Nov 2009
- Posts
- 75
- Rep Power
- 0


LinkBack URL
About LinkBacks


Bookmarks