java - Implementing interfaces and scanner properties -


i have been set assignment create telephone directory incorporates use of interfaces. started directoryentry defines , set methods contacts name , number. provided interface, , have implement it.

however stuck on how implement first method, loaddata:

void loaddata(string sourcename);    /** entry.   @param name name of person   @return telno or null if name not in directory   */  

i have been given pseudocode template follow, still unsure how approach it, appreciated!

pseudocode stub:

create scanner read file   while (not end of file)   use scanner read name   use scanner read telno   create directoryentry   add new entry thedirectory   close file 

this closest have come far still think off:

public loaddata (string sourcename) {     // creating new scanner object     scanner scan = new scanner(sourcename).usedelimiter("\\z");      while (scan.hasnextline())     {         scan.findinline(sourcename);     } 

thanks in advance help.

the method signature should have void:

public void loaddata(string sourcename) 

however, seems odd void method named "loaddata" used data, since doesn't return anything. sure comment there says "look entry" goes method? expect such method signature correspond method takes data 1 place , puts in place, private field (like kind of map) in class.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -