Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 20 of 20

Thread: Java program which scann file as per user input and return contents of file as output

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Java program which scann file as per user input and return contents of file as output

    Hello all,

    i m quite new in java,i like to write a JAVA program which show locations of geographical coordinates i.e. longitude and latitude in square shape,i have list(.csv formate) of coordinate positions with e.g. with three different type let say!

    detector_A(longitude,latitude),
    detector_B(longitude,latitude),
    detector_C(longitude,latitude) etc.

    list of above mention coordinate is look like this,

    HTML Code:
    Detectors      Longitude      Latitude
    
    Detector_A   5.123.818	    67.754.407
    Detector_A	  5.120.653	    67.896.657
    Detector_A   5.266.537	    67.765.512
    
    Detector_B	  5.120.656     67.765.317
    Detector_B	  5.120.667     677.656.10
    Detector_B	  5.120.676     67.765.512
    
    Detector_C	  5.120.698	    67.765.589
    Detector_C	  5.120.654	    67.765.592
    Detector_C	  5.120.659     67.765.533
    Now my aim is to catch the locations of detectors A,B,C with with their longitude and latitude values and then show these location A,B,C in square box as per user input,i.e. when user enter the longitude & latitude value then my java program should show that particular longitude/latitude in square box.

    I know how to code empty square shape in simple java as simple it is....see code.

     
    class Square 
     
                   //Square of stars
    {
     
        public static void main(String[] args) 
        {
            String tenStars="**********";
            String oneStar="*";
            int count=0;
     
            System.out.println(tenStars);
            count++;
            while(count<=8)
            {
                System.out.println(oneStar+"     "+oneStar);
                count++;
            }
            System.out.print(tenStars);
     
        }
    }



    But how i can make this square shape in action to catch the detectors data i.e. longitude and latitude positions as per user input requeirments e.g. user enter the location,

    Longitude = 5.120.659 and Latitude = 67.765.533 (just an example values,

    then program should show that position of longi & lati in square shape as output.

    any help,idea,feed back or example etc would be very much appreciated.

    Regards,

    Uzaman26


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    program should show that position of longi & lati in square shape as output.
    Can you post an example of what you want the program to output? Put the output in code tags to preserve the spacing.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Quote Originally Posted by Norm View Post
    Can you post an example of what you want the program to output? Put the output in code tags to preserve the spacing.

    Ok thanks for response,i can make it more easy to understand,like as in my first post i sent info that,detectors are in three different categories we called them

    detector_A,
    detector_B,
    detector_C.

    In fact these detectors are just providing us geographical locations on one virtual map,and of course if we are talking about maps,then maps can just easily read by locations in term of longitude and latitude etc.

    Now my aim is just to write a intractive java program which have option for user(input box) to enter the locations e.g. samll GUI Fram etc

    Longi(button) = [ values from list ]
    Lati(button) = [ values from list ]
    Search(Button) Cancle(button)


    That's mean user have two options either entered value he will search by clicking Search(button) or even if he enters wrong then he can click Cancle(button) and enter value again to search.
    that's mean if i m user and i enter valid location of longitude and latitude, then my program goes to file of detector and search those location in list,and then just browse those location on map in square shape box to user as "OUTPUT".

    Now again two things are very important to distinguish......

    1st - I have list of detector with longitudnal and latitudinal parameters (example given below)
    2nd - Data of this list i.e. (Longi & Lati) are actually collected from one virtual map.

    List is look like this as i mention in my very first post(this is just an example,list is in .csv kind and is quite large,like over 700 detectors of kind A,100 of kind B and 50 of kind C,actually its quite difficult to attachsuch this files with this post,that is why i like to send example list in following.

    Detectors                Longitude                Latitude 
     
    Detector_A             5.123.818                66.165.489
    Detector_A             5.153.618                67.965.589
    Detector_A             5.452.818                87.765.389
    Detector_B             5.193.118                27.365.089
    Detector_B             5.133.718                17.665.289
    Detector_B             5.623.818                67.765.089
    Detector_C             5.263.718                47.735.589
    Detector_C             5.303.877                27.165.229
    Detector_C             5.754.891                68.365.389

    Conclusion: Output of my program just search the detector by its "longi" and "lati" position and show me that position in small box of square shape(8X8 )cm or so etc.

    any idea or any extention (even) little one will be very appreciated ,i hope i clear all....but if there are still sone thing not clear then please drop me question,i like to clear more.

    Regards

    Uzaman26

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    show me that position in small box of square shape(8X8 )cm or so etc.
    What would that look like?

    Why does each detector have 3 lines with lat/long values?

    search those location in list
    How is a match found between the lat/long the user entered and the data in the list?

    I can imagine a list of pairs of points that define a rectangle (upper left and lower right) and the search for what pair of points contains the point entered by the user.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    "show me that position in small box of square shape(8X8 )cm or so etc."


    Please see image in .GIF file after the next text,here i also must clear some thing more...which was not same as i said before!

    User must enter the pair of longitude and latitude,because if user like to see "longi" & "Lati" position in square box,then only one position for each "longi" & "Lati" will not help user at all to cover detector area in sqr_box.....that's mean what i post last time was not 100% correct idea to cover the detector area in square only to take one position of "longi" & "Lati".....user must enter pair of "longi" & "Lati"

    And my java program should give output of location in square box same as you can see in attached image.....
    2013-03-13_185019.GIF


    Your Question >> Why does each detector have 3 lines with lat/long values?

    i mention i my last post detectors are many ovver 1,200 and also kind of type what i post like detector_A,B and C was also just as an example,because i can't attach large file with post,nevetheless now here i m sending you exact name of detectors and also longitude & latitude positions in table within QUOTE tags.


    DetectorsType Latitude Longitude

    1st_type:
    ----------
    fs.MQ_3.110_AB_NO_R_ 151.35008 6.859478
    fs.MQ_3.110_AB_SW_L_ 151.34971 6.8540416
    fs.MQ_3.110_AB_SW_R_ 151.34919 6.8546185
    fs.MQ_3.110_HFB_NO_ 1 51.348618 6.859673
    fs.MQ_3.110_HFB_NO_ 2 51.348595 6.859648
    fs.MQ_3.110_HFB_NO_ 3 51.348576 6.859624
    fs.MQ_3.110_HFB_SW_ 1 51.35013 6.8548093
    fs.MQ_3.110_HFB_SW_ 2 51.35015 6.854832
    fs.MQ_3.110_HFB_SW_ 3 51.350174 6.8548546
    fs.MQ_3.110_ZU_NO_L_ 1 51.34923 6.8591533
    fs.MQ_3.110_ZU_NO_L_ 2 51.34925 6.8592854
    fs.MQ_3.110_ZU_NO_R_ 1 51.350643 6.8553977
    fs.MQ_3.110_ZU_SW_L_ 1 51.34963 6.855599
    fs.MQ_3.110_ZU_SW_R_ 1 51.34781 6.8584666
    fs.MQ_3.120_HFB_NO_ 1 51.32273 6.894591
    fs.MQ_3.120_HFB_NO_ 2 51.322727 6.8945417
    fs.MQ_3.120_HFB_NO_ 3 51.322727 6.8944926
    fs.MQ_3.130_HFB_NO_ 1 51.295135 6.8972964
    fs.MQ_3.130_HFB_NO_ 2 51.29513 6.8972545
    fs.MQ_3.130_HFB_NO_ 3 51.295128 6.897212
    fs.MQ_3.130_HFB_SW_ 1 51.294964 6.8968782
    fs.MQ_3.130_HFB_SW_ 2 51.294964 6.896922
    fs.MQ_3.130_HFB_SW_ 3 51.294964 6.8969655
    fs.MQ_3.130_ZU_NO_L_ 1 51.29703 6.8972073
    fs.MQ_3.130_ZU_SW_R_ 1 51.296524 6.8956265


    2nd_type:
    -----------
    IDe-12-01-A1-MAGV1a 51.238186 6.7754803
    IDe-12-01-A1-MAGV2a 51.23818 6.7754407
    IDe-16-03-C1-MCGV1a 51.21885 6.766429
    IDe-16-03-C1-MCGV2a 51.218834 6.7663965
    IDe-16-03-C1-MCRV1a 51.21878 6.7662826
    IDe-16-03-C1-MCRV2a 51.21877 6.7662444
    IDe-16-03-D1-MDGH2a 51.218895 6.7664843
    IDe-16-03-D1-MDGH3a 51.21895 6.766571
    IDe-24-02-D1-MCGV1a 51.240753 6.7441163
    IDe-24-02-D1-MCGV2a 51.240726 6.7441187
    IDe-24-02-D1-MDGV1a 51.24089 6.74421
    IDe-24-02-D1-MDGV2a 51.240917 6.744202
    IDe-31-02-D1-MDGV1a 51.245045 6.7884192
    IDe-31-02-D1-MDGV2a 51.245064 6.788389
    IDe-32-02-B1-MAGV1a 51.246513 6.7718277
    IDe-32-02-B1-MAGV2a 51.246517 6.771785
    IDe-32-02-B1-MAGV3a 51.246513 6.771742
    IDe-32-02-B1-MBGV1a 51.246418 6.7722425
    IDe-32-02-B1-MBGV2a 51.246414 6.772286
    IDe-32-02-B1-MBGV3a 51.246418 6.772329
    IDe-32-03-C1-MCGV1a 51.25107 6.7671123
    IDe-32-03-C1-MCGV2a 51.251045 6.767136
    IDe-32-05-B1-MBGV1a 51.242264 6.7734056
    IDe-32-05-B1-MBGV2a 51.242275 6.773443
    IDe-33-01-B1-MAGV1a 51.258564 6.7618895
    IDe-33-01-B1-MAGV2a 51.25856 6.7618475
    IDe-33-01-B1-MBGV1a 51.258522 6.762102
    IDe-33-01-B1-MBGV2a 51.25853 6.762144


    3rd_type:
    ----------

    VDe-11-01-A1-MAGH1a 51.23062 6.7712684
    VDe-11-01-A1-MAGH2a 51.23063 6.771226
    VDe-11-01-A1-MBGV1a 51.230644 6.771552
    VDe-11-01-A1-MBGV2a 51.230637 6.771594
    VDe-11-01-A1-MBGV3a 51.23061 6.7716293
    VDe-16-01-C1-MDGH1a 51.218414 6.7679677
    VDe-16-01-C1-MDGH2a 51.218437 6.76799
    VDe-16-02-D1-MCGV1a 51.21788 6.767214
    VDe-16-02-D1-MCGV2a 51.21788 6.767204
    VDe-16-02-D1-MCGV3a 51.21786 6.767172
    VDe-21-01-D1-MCGV1a 51.231567 6.7347345
    VDe-21-01-D1-MCGV2a 51.23155 6.7347054
    VDe-21-01-D1-MDGV1a 51.231655 6.734968
    VDe-21-01-D1-MDGV2a 51.231667 6.73499
    VDe-21-02-D1-MCGV1a 51.23154 6.7359924
    VDe-21-02-D1-MCGV2a 51.231514 6.735983
    VDe-21-02-D1-MDGV1a 51.231647 6.7360992
    VDe-21-02-D1-MDGV2a 51.231674 6.7361135
    VDe-21-04-A1-MBGV1a 51.223545 6.760769
    VDe-21-04-A1-MBMV1a 51.22356 6.760806
    VDe-21-04-A1-MBRV1a 51.223576 6.7608404
    VDe-21-04-B1-MAGV1a 51.22408 6.760073
    VDe-21-04-B1-MAGV2a 51.22406 6.7600403
    VDe-21-04-B2-MAGV3a 51.224007 6.7599335
    VDe-22-01-D1-MCGV1a 51.233105 6.7138886
    VDe-22-01-D1-MCGV2a 51.233078 6.713898
    VDe-22-01-D1-MCGV3a 51.233047 6.713892
    VDe-22-01-D1-MDGV1a 51.233265 6.7138987
    VDe-22-01-D1-MDGV2a 51.23329 6.7139072
    VDe-22-01-D1-MDGV3a 51.23332 6.71392
    VDe-24-01-B1-MAGV1a 51.237675 6.735493
    VDe-24-01-B1-MAGV2a 51.237686 6.7354546



    I hope now it more clear than before, if still not clear,then please inform.....no problem at all

    Best regards,

    Uzaman26






  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    I don't understand how a "descriptor" can have more than one line in the data file with different lat and long values.

    The sample you posted always had 3 values, so I concluded that they all had 3.
    How many different values (lines with lat/long) can a descriptor have? Can it have just 1?

    What if it has 200?


    User must enter the pair of longitude and latitude
    Do those two lat/long then define a rectangle(upper left, lower right)?

    What is to be done with that rectangle?
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    #I don't understand how a "descriptor" can have more than one line in the data file with different lat and long values.

    thanks for response,from "descriptor" if you mean "Detectors_Types" then i can say yes detectors are of three kinds,

    fs.MQ_3.110_AB_NO_R_(this is detector of kind "fs.MQ",other digits and alphabet have also some meaning,but nothing to do with java program).

    IDe-12-01-A1-MAGV1a (this is detector of kind "IDe").
    VDe-11-01-A1-MAGH1a (this is detector of kind "VDe").

    I also attached now file of detectors in .txt file so you can see how many detectors are of each kind(this list of data comes from one MAP).

    #The sample you posted always had 3 values, so I concluded that they all had 3.
    How many different values (lines with lat/long) can a descriptor have? Can it have just 1?



    The order of this list with longi/Lati are like this,

    Detectors_Type                      Latitude                      Longitude
     
    fs.MQ_3.110_AB_NO_R_                 151.35008                    6.8540416

    Longi/Lati always changed after to cover the small distance on any "MAP" so even if some one start at first position of "A" and covered little distance until point "B",then position "A" longi/Lati will be not the same as position "B".,i hope now it clear to you why in list Longi/Lati have different values at each position.

    #Do those two lat/long then define a rectangle(upper left, lower right)?


    Ok you call it rectangle and i wrote before square......yes you are right upper left (combination of Longi/lati) and lower right (combination of Longi/lati),i attached another image which help you to realize how rechtangle or square will be look like.Shape.pngthis.

    #What is to be done with that rectangle?

    That's what is my aim to write java program which help user to enter the "upper left (combination of Longi/lati) and lower right (combination of Longi/lati) of any detector as "INPUT" and then progrm will show as "OUTPUT" the position of detector to user which he/she entered.

    This program will be use full only for user who already have list of detector with longi/lati etc,so they can see the position and status of requeired detector in rechtangle or square shape any time on MAP after just to enter the Longi/lati as i clear above
    Attached Files Attached Files

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Is this what you are trying to do:
    User enters two points(lat/long) and the program searches the detector list and finds some/all points in the list that are inside the rectangle defined by the points the user entered.
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Quote Originally Posted by Norm View Post
    Is this what you are trying to do:
    User enters two points(lat/long) and the program searches the detector list and finds some/all points in the list that are inside the rectangle defined by the points the user entered.
    Yes exactly,that when user enter the" longi/lati" position given in list,then program will search the list and find the match of "langi/lati"(which user entered...as "INPUT") for selected detector and program should show position of detector,as "OUTPUT".

    actually i like to write very simple program in java,as program in java is always resueable and use full for many operating systems,any example or idea will be help full,if you know any source in internet or even name of book in Java for such program,then please share it.

    thanks

    Uzaman26

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    What problems are you having finding if a point in the GeoDetectors file is inside the rectangle from the points the user entered?
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Quote Originally Posted by Norm View Post
    What problems are you having finding if a point in the GeoDetectors file is inside the rectangle from the points the user entered?
    1st>>> Ok as you can see file have many detectors(only three of different kind) with different "longi/lati" so if i start to search list with "start_key",then how i have to select this "start_key",because some how all the time user need random access to the element of list, i.e. if user like to get"longi/lati" of the very last detector of type "VDe" in the list,then he can't find easily if i develope program with ordinary linear or binary search,because runtime of program will goes exponentially large as file is too big!.

    So that's mean i have to use a search algorithm which provide user quickly random access to any detector no matter if its at start or end!

    2nd >>> As i said in my very very fisrt mail,i m totaly new in java but have other programming know-how of lower average level,but i m doing my best to learn fast and more in java as i start to like it,so that is why i have no idea how one can define an recangular shape or square which show selected detectors data within rechtangle or square shape interactively as i tell you all the time in my previous posts.

    Only just to draw an rechtangle or square in jave is so easy i can do this in few seconds,but i have little trouble to write a program which search list in random manner and then show result in rechtangle or square shape etc.

    R,
    Uzaman26

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    search list in random manner
    Why in a random manner? Does that mean that some of the items in the list are not looked at during the search?
    How many of the items in the list should be looked at? For example if the list had 1000 items and the search looks at 300 for a match, then there would be 700 items that were not looked at.

    Do you want to find ALL of the items in the list that are in the rectangle?
    Or just those that were randomly looked at (300 out of 1000)? That means there could be some items in the 700 that are in the rectangle but not found because of the random search only looking at 300.

    I don't understand what the purpose of the random search is. Is it supposed to be some kind of random sampling?
    If you don't understand my answer, don't ignore it, ask a question.

  13. #13
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Quote Originally Posted by Norm View Post
    Why in a random manner? Does that mean that some of the items in the list are not looked at during the search?
    How many of the items in the list should be looked at? For example if the list had 1000 items and the search looks at 300 for a match, then there would be 700 items that were not looked at.

    Do you want to find ALL of the items in the list that are in the rectangle?

    Or just those that were randomly looked at (300 out of 1000)? That means there could be some items in the 700 that are in the rectangle but not found because of the random search only looking at 300.

    I don't understand what the purpose of the random search is. Is it supposed to be some kind of random sampling?
    #Why in a random manner?

    because as you can see in list,"longi/lati" position(item of list) are not in in any ascending or descending order,in other word i mean there is no clear pattern of numbers like (1,2,3,4.....) or (2,4,6,8....) etc are have clear pattern,but in list "longi/lati" are indepandent of any such pattern.

    #Does that mean that some of the items in the list are not looked at during the search?

    Yes 100% correct it possible,we don't need to search all item of list at same time or togather etc,our aim is to search only requeired item which we entered in search input box.

    #How many of the items in the list should be looked at? For example if the list had 1000 items and the search looks at 300 for a match, then there would be 700 items that were not looked at.

    All togather there are 939 item(detectors) in the list 770 of them "fs.MQ_type", 57 are "IDe_type" and 112 are of "VDe_type".

    So if our list have 939 item and we want to search only one among them,then we don't need to care rest 938 those left,that's mean program search just item(combination of longi/lati for upper right corner and lower left corner) which we enter in Input box.

    #Do you want to find ALL of the items in the list that are in the rectangle?

    No,item are not already in rechtangle,my aim is to write program in java which search item in the list and show them in rechtangle box on the map,that's mean there is no rechtangle pre exist,we have to define this rechtangle shape in our java program which will show us location of detector(item of list) for entered "longi/lati" values same as i mention above.

    #Or just those that were randomly looked at (300 out of 1000)? That means there could be some items in the 700 that are in the rectangle but not found because of the random search only looking at 300.

    We don't need to search 300 item at a time,there is no such requeirments.As i clear above there are total 939 item in list,so we just like to search one item among 939 and we want to see this item in rechtangle shape....again i have to tell this,list data is came out from a MAP and we like to search item on Map and we want to see this inputed item in rechtangle box or square box on MAP.

    #I don't understand what the purpose of the random search is. Is it supposed to be some kind of random sampling?

    purpose of this random search is to observe and analyze the state/position or status of detector as per user requeirments,and why random? becasue if user like to search item(detector) at No.30,then he get no problem to find item i.e. detector by its longitudinal and latitudinal positions which easily accessible for him on the MAP in the rechtangle shape etc.

    I hope now all is clear if still not then plz write back,any way.

    Thanks & regards,

    Uzaman26

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    search only requeired item which we entered in search input box.
    I don't understand what you think is possible with a search. How will the program know when to stop searching?
    What if there are 1000 items in the list, when should the search stop? When it has found 1 item or how many does it need to find before it stops searching? What if it has looked at 500 and not found a match, should it continue looking at the next 500 or when does the search stop looking?
    What if the desired item is the last one in the list? The search will have had to look at 999 items before it finds the one item that is desired.
    If you don't understand my answer, don't ignore it, ask a question.

  15. #15
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Quote Originally Posted by Norm View Post
    I don't understand what you think is possible with a search. How will the program know when to stop searching?
    What if there are 1000 items in the list, when should the search stop? When it has found 1 item or how many does it need to find before it stops searching? What if it has looked at 500 and not found a match, should it continue looking at the next 500 or when does the search stop looking?
    What if the desired item is the last one in the list? The search will have had to look at 999 items before it finds the one item that is desired.
    YOUR COMMENTS ARE IN BLUE TAGS:

    #I don't understand what you think is possible with a search. How will the program know when to stop searching?

    Well if some one do programming for long time,then he also have to think about if search suitable for such situation or not,if you think with search is not possible then what is your idea about such situation ? tell me your idea.

    #What if there are 1000 items in the list, when should the search stop?

    There are no 1000 elements in list!!,there are 939 elements in list i wrote all the time in my last posts.

    #When it has found 1 item or how many does it need to find before it stops searching?

    I wrote very clear in my previous posts,list have only "939" elements(detectors) and each detector have its "longi/lati" value in the list,user need to find requeired detector after to enter its longitude and latitude values to find requeired detector in rechtangle or square box on the MAP,its understood that when user enter elements which is already in the list,then program will search that iteam and stop to search further.

    #What if it has looked at 500 and not found a match, should it continue looking at the next 500 or when does the search stop looking?

    This i also wrote in my previous post,many time this program will be use only by users those have list in hand,that mean user will use list elements from list (which i also sent in text file in my last post) to enter the position of detector(what you call elements) of list and then find element of its choice......if user have list of elements in hand then its impossible for him/her not able to find enter element,becasue the element which user will enter,will be only after to see list of elements.

    #What if the desired item is the last one in the list? The search will have had to look at 999 items before it finds the one item that is desired.

    That's a job of programmer! to use suitable search algorithm which help to find any element (even last one!) in list as quick as possible,that mean linear kind of search will not help,here programmer need some theoretical knowledge of data structures,i hope i make my self clear,i have not much experience in programming but i know still beside syntax of any high level programming,semantic understanding is also essential.

    AGAIN I LIKE TO WRITE PROGRAM IN JAVA WHICH HELP USER TO FIND DETECTOR IN GIVEN!! LIST (THAT'S MEAN PROGRAMMER HAVE LIST IN HAND) BY ITS LONGITUDE AND LATITUDE VALUES as (INPUT) PROGRAM SHOULD SHOW ENTERED LANGITUDE & LATITUDE IN SQUARE_RECHTANGLE BOX as (OUTPUT).
    ve' a nice day!

    Uzaman26,

  16. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Sorry, I have no idea what you are expecting the program to do.
    If you don't understand my answer, don't ignore it, ask a question.

  17. #17
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Quote Originally Posted by Norm View Post
    Sorry, I have no idea what you are expecting the program to do.
    Hallo,see this link and realize what i m doing,

    Showing current location in Google Maps with GPS and LocationManager in Android | Knowledge by Experience


    only difference is i m not doing this for Android apps,i have a list of "Longi/Lati" in my own hand and i just like to use this list to find locations of detectors and show them in in text box etc....but i m doing all in java.

    if no interest,than no problem just ignore my post.

    Regards

  18. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Post the code you are having problems with and ask some specific questions about the problems you are having.

    I wrote a waypoints program to work with my GPS several years ago.
    If you don't understand my answer, don't ignore it, ask a question.

  19. #19
    Junior Member
    Join Date
    Mar 2013
    Location
    Germany,Essen
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    Quote Originally Posted by Norm View Post
    Post the code you are having problems with and ask some specific questions about the problems you are having.

    I wrote a waypoints program to work with my GPS several years ago.

    I found another very nice example where you can see what my objective is? example is of .NET

    Find a place using latitude and longitude coordinates


    but i m just trying to develope same small application in java and instead of "My Pushpins" i m trying to see longitude and latitude in square or rechtangle box etc.

    Ok i m doing now as soon i done some thing i'll share,no problem at all,

  20. #20
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java program which scann file as per user input and return contents of file as output

    You can use a linear search for the first version to get a working program. Later you can organize the list of waypoints to make the search faster.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. [SOLVED] File input and file output
    By maple1100 in forum What's Wrong With My Code?
    Replies: 12
    Last Post: December 26th, 2012, 10:11 PM
  2. counting the values in input file and and writing the output to a file
    By srujirao in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 8th, 2012, 02:48 PM
  3. User Input File Name
    By PineAppleKing in forum Java Theory & Questions
    Replies: 12
    Last Post: June 3rd, 2011, 10:23 AM
  4. Input output file help
    By peteyfresh12 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 2nd, 2011, 07:44 AM
  5. Input/Output file help
    By Plural in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 25th, 2010, 08:34 PM