Searching for String in Vector

I know I posted just a few minutes ago about sorting, but I'm making a program (not related to homework at all, this is all for my parents business) and my program needs to store names and fetch them. We have thousands of people in our contacts so it's only logical that I would provide searching so that my mom could easily find a contact she is looking for.
The contacts are stored in a vector, first name, last name, address, etc. I want to provide a search function that can search the names, or addresss, or both. Then, when a match is found, it returns the results to a JList or something.
Search Text: "St. Marie"
Results:
1. St. Marie, Josh
2. St. Marie, Someone
etc etc...

My program uses files, it uses the files to populate the vector. I'm using a vector, not an array or anything else to access the data in the files. heres a sample of the save method in my program.private void saveContacts ()
      FileOutputStream fos = null;
      try
          fos = new FileOutputStream ("contacts.dat");
          DataOutputStream dos = new DataOutputStream (fos);
          dos.writeInt (contacts.size ());
          for (int i = 0; i < contacts.size (); i++)
               Contact temp = (Contact) contacts.elementAt (i);
               dos.writeUTF (temp.fname);
               dos.writeUTF (temp.lname);
               dos.writeUTF (temp.phone);
               dos.writeUTF (temp.fax);
               dos.writeUTF (temp.email);
      catch (IOException e)
         MsgBox mb = new MsgBox (this, "CM Error",
                                 e.toString ());
         mb.dispose ();
      finally
         if (fos != null)
             try
                 fos.close ();
             catch (IOException e) {}
   }The variable "contacts" is my vector.

Similar Messages

  • Is it possible to search for strings containing spaces and special characters?

    In our RoboHelp project, there are figures with text labels such as Figure 1, Figure 3-2, etc.
    When I search for "Figure 3" I get all pages containing "Figure" and "3", even if I surround it in quotes.  Similarly, searching for "3-2" treats the '-' character as a space and searches for all pages containing '3' or '2'.
    Is there a way to search for strings containing spaces and special characters?

    In that case I think the answer is no if you are using the standard search engine. However I believe that Zoom Search does allow this type of searching. Check out this link for further information.
    http://www.grainge.org/pages/authoring/zoomsearch/zoomsearch.htm
      The RoboColum(n)
      @robocolumn
      Colum McAndrew

  • Searching for strings in a txt file

    I am writing a program based on the six degrees of seperation theory.
    Basically I have been given a (very large) txt file from the imdb with a list of all the films written in it.
    The text in the document is written like this:
    'Tis Autumn: The Search for Jackie Paris (2006)/Paris, Jackie/Moody, James (IV)/Bogdanovich, Peter/Vera, Billy/Ellison, Harlan/Newman, Barry/Whaley, Frank/Murphy, Mark (X)/Tosches, Nick (I)/Moss, Anne Marie
    (Desire) (2006)/Ruggieri, Elio/Micijevic, Irena
    .45 (2006)/Dorff, Stephen/Laresca, Vincent/Eddis, Tim/Bergschneider, Conrad/Campbell, Shawn (II)/Macfadyen, Angus/John, Suresh/Munch, Tony/Tyler, Aisha/Augustson, Nola/Greenhalgh, Dawn/Strange, Sarah/Jovovich, Milla/Hawtrey, Kay
    10 Items or Less (2006)/Ruiz, Hector Atreyu/Torres, Emiliano (II)/Parsons, Jim (II)/Freeman, Morgan (I)/Pallana, Kumar/Cannavale, Bobby/Nam, Leonardo/Hill, Jonah/Vega, Paz/Echols, Jennifer/Dudek, Anne/Berardi, Alexandra
    10 MPH (2006)/Weeks, Hunter/Armstrong, Pat (II)/Caldwell, Josh/Waisman, Alon/Keough, Johnathan F./Weeks, Gannon
    10 Tricks (2006)/Cruz, Raymond/Swetland, Paul/Selznick, Albie/Hennings, Sam/Gleason, Richard/Leake, Damien/Skipp, Beth/Ishibashi, Brittany/Thompson, Lea (I)/Jinaro, Jossara/Brink, Molly
    1001 Nights (2006)/Wright, Jeffrey (I)
    10th & Wolf (2006)/Lee, Tommy (VI)/Renfro, Brad/Ligato, Johnny/De Laurentiis, Igor/Luke Jr., Tony/Mihok, Dash/Garito, Ken/Capodice, John/Dennehy, Brian/Gullion, Jesse/Salvi, Francesco (I)/Cordek, Frank/Marsden, James (I)/Bernard, Aaron/Brennan, Patrick (VII)/O'Rourke, Ben/Gallo, Billy/Heaphy, James/Stragand, Dave/Vellozzi, Sonny/Pistone, Joe (I)/Morse, David (III)/Landis, Pete/Cain, Atticus/Trevelino, Dan/Demme, Larry/Sisto, Frank/Rosenbaum, Paul/Grimaldi, James (I)/Ribisi, Giovanni/Hopper, Dennis/Devon, Tony/Sigismondi, Barry/Kilmer, Val/Marinelli, Sonny/Cacia, Joseph/Rossi, Leo (II)/Tott, Jeffrey/Wawrzyniak, Aaron/Boombotze, Joey/Marie, Corina/Arvie, Michilline/Warren, Lesley Ann/De Laurentiis, Veronica/Moresco, Amanda/Boecker, Margot/Rossi, Rose/Latimore, Meritt/Dunlap, Doreen/Perabo, Piper/Horrell, Nickole/Sonnichsen, Ingrid
    11 Minutes Ago (2006)/Irving, Len/Welzbacher, Craig/Michaels, Ian/Dahl, Evan Lee/Gebert, Bob/Juuso, Jeremy/Hope, Trip/Green-Gaber, Renata/Dawn, Turiya/Reneau, Taryn/M
    Thats just 2 lines!
    what the program will do is take in a name (from a gui) of an actor/actress and find the smallest connection to a famous actor.
    So first things first, my idea of thinking is to search the file for K.E.V.I.N. B.A.C.O.N and all his films, and safe them into an array. Then do another search for films from the actor that the user entered at the gui. then find the shortest possible connection to both stars.
    my code for the search part of the program
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.File;
    import java.io.FileNotFoundException;
    public class FileSearch {
         File aFile = new File("cast.06.txt");     
         FileInputStream inFile = null;
         String actor = "surname, forename"; // the person who will be the centre point e.g. kevin.bacon.
           //get the result of the actor from the gui will go here.
         public void openFilm()
              try
                  inFile = new FileInputStream(aFile);     
              catch(FileNotFoundException e)
                   System.out.println("Error");
    }The problem I have is that I can't work out how to search the txt file for a specific string/s and save them into an array. (I'm not sure if this is the best way to go about it or not at this stage).
    So whats the best way to search for an actor from that file and save the film title and the year of release?
    Hope this makes sense? what I hope the final program will be like is like this http://oracleofbacon.org/

    I went away and looked at regular expressions and this is what I came up with
    public class NameSearch{
         public static void main(String[] args)
              NameSearch ns = new NameSearch();
              ns.runIt();
         public void runIt()
              java.util.Scanner fileScan = null;
              try{
                   fileScan = new java.util.Scanner(new java.io.File("imdb.txt"));
              }catch(java.io.FileNotFoundException e)
                   e.printStackTrace();
                   System.exit(0);
              String token = null;
              String actor = "Surname, Forename";
    //real name will go in actor, left it like that for example
              while(fileScan.hasNext()){
                   token = fileScan.next();
                   Pattern pattern = Pattern.compile(actor);
                   Matcher m = pattern.matcher(token);
                   while(m.find())
                        System.out.println(m.start() + m.end());
    }This by any means not finished, I'm just trying to get to grips with regualr expressions. But when I run the program it doesn't return anything, from what I've tried to work out is it should return actor x amount of times they appear in the file. But when I run it nothing comes back (the actors name is in the text file) so I'm not too sure what I'm doing wrong, any suggestion please

  • Searching for string in text files on XP

    Hi,
    At the moment I'm working on a Struts program. The output I get is:
    The requested resource (Invalid path /displayAddProductForum was requested) is not available.Somewhere in my files, I have a line containing /displayAddProductForum that should be displayAddProductForm. As I'm using XP as my development platform, I use the 'Windows Explorer' search facility. And I have noticed this search facility does not look in .java, .jsp and any other file with a non-Microsoft file-extension. So, how do you search for a string in a source file on XP?
    Abel

    sabre150 wrote:
    kajbj wrote:
    sabre150 wrote:
    Abel wrote:
    , I use the 'Windows Explorer' search facility. And I have noticed this search facility does not look in .java, .jsp and any other file with a non-Microsoft file-extension. So, how do you search for a string in a source file on XP? Err.. On my XP it does search though java/jsp files if I tell it to!You mean by modifying the registry?No! Using the right mouse click on a directory to get a context menu -> Search -> (All or part of filename : .java ) and (A word or phrase in the file : blah blah blah) -> Search
    Edit : Errr.. maybe I'm talking rubbish because I have just tested this and it only finds 5 java files of mine that contain the word 'class'! I'm sure it used to work because in my 'Windows' days I frequently used it.
    Edited by: sabre150 on Dec 20, 2007 12:44 PMSounds a bit odd. Search in windows should only search in registered file types and neither jsp nor java are registered types. It's however possible to modify the registry and add extensions (but it's not possible to say search within all types of files, and that sucks)

  • Search for string in PlSql-Code

    Hi
    I have a simple question. Is it possible to search for a string in all PlSql-Proceduren (Packages, Procedures, Functions, Triggers, Views). How can i find out where a certain package-prodedure/function is referenced.
    Thanks

    View -> Extended search. In 11.1 it would query against plscope dictionary views supported by rdbms. In lower versions it would reduce to querying all_source.

  • Search for string and move decimal

    Hello,
    I am trying to write code that will search for a fractional string within an array and convert it from mV to V so it can be properly compared to the other fractional string numbers in the array.
    I have an array that outputs x iterations  each with a minimum and maximum column including several different types of decimal strings (negative/positive with several decimal places) each ending with either mV and V (example string: -725.543mV).
    I then split the array into columns containing the minumum and maximum values of each iteration. I want to compare the minimum values of each iteration and find the most minimum, and do the same thing with the maximum values.
    Unfortunatley the way I'm doing it, when I convert from fractional string to number it removes the V or mV unit label but does not convert the number from mV to V. so it compares -725.543mV with -52.334V as -725.543 & -52.334 thus declaring the mV value the most minimum. I need the program to recognize that mV is less than V or search each array for values labeled with mV and move the decimal place so it is in standard V format.
    The unit label is actually part of the string and not the display (as you can see in the code I've attached) and I understand this is a little tricky with the way I have to do it. But this is a dumbed down chunk of code I will eventually incorporate into my larger program which reads the values and their units from several different types of oscilloscopes. The Scopes output the values as strings as they appear on the screen and don't differentiate between mV and V unless they are told to output the units which just tags them on the end of the string.
    I'm sorry for the large post. SO to sum up I need to search an array to make sure all values have the same units, if they don't I need to convert each value to the proper unit and output the max and min from the resulting array. my code is attached. Thank you for your help.
    Solved!
    Go to Solution.
    Attachments:
    File manipulation.vi ‏15 KB

    crossrulz wrote:
    jcarmody wrote:
    camerond wrote:
    Sorry, Jim, that's not quite right. You forgot to consider significant figures (your third min is not quite right). [...]
    Good catch, but, really?   
    That "Finally!" comes out to -5569492V to me.  Holy crap.  -5.569492MV!  I think there's a problem there.
    Carp! Stupid negative numbers, shouldn't be allowed. Put a piece of duck tape over the place for that negative sign, that'll fix it.
    I'll get back, it's now a matter of principle.
    Jim, how does your algorithm do when there are 8 or 9 sig figs, say -56.9492345mV? (Yep, too lazy to draw it in myself.)
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • Search for string in paragraph and apply a new character style?

    I'm searching for a way to find a specific string in a specific text frame and make it bold. so my thought was to search and then apply a character style from my template doc. I thought this would work, but I went wrong somewhere.
    newDoc is my document. 
    //something like
    var Bios = "Representative Biography:\r want to leave this text normal.";
    var myTextFrameBios = newDoc.pages.item(i).textFrames.add({geometricBounds:[4.5277, 2.36, 8.625, 5.375], contents:Bios});
    var myTextObjectBios = myTextFrameBios.parentStory.texts.item(0);
    // IS THIS CONFLICTING with my change below? Can I apply a character style within a par styled frame?
    myTextObjectBios.appliedParagraphStyle = newDoc.paragraphStyles.item("CompanyProfile");
                                                      //Clear the find/change preferences.
                                                    app.findGrepPreferences = NothingEnum.nothing;
                                                    app.changeGrepPreferences = NothingEnum.nothing;
                                                    app.findTextPreferences.findWhat = "Representative Biography:";
                                                    app.changeTextPreferences.changeTo = "Representative Biography:";
                                                    app.findGrepPreferences.appliedCharacterStyle = newDoc.characterStyles.item("BoldBioHead");
                                                    // Perform the operation
                                                    app.documents.item(0).changeGrep();
                                                    app.findGrepPreferences = NothingEnum.nothing;
                                                    app.changeGrepPreferences = NothingEnum.nothing;

    @caseyctg – If you want to apply a character style to a text object in a specific text frame, you could restrict the scope of your script to that specific text frame:
    Example with the variable "myTextFrame" you have to define before:
    myTextFrame.changeText();
    Btw.: you are doing a text search and clearing your GREP find/change preferences at the start of the snippet? Why is that?
    You could do a:
    app.changeTextPreferences = app.findTextPreferences = NothingEnum.nothing;
    or:
    app.changeTextPreferences = app.findTextPreferences = null;
    set before the search and after the change, if you want to be on the safe side…
    Uwe

  • Searching for String literals in a ResultSet

    Hi! I am currently working in a little project in which one functionallity should be the possibility to search for customers over a special dialog. This dialog consists of a JTextField and a JTable. Now when the user enters e.g. 'a' in the textfield all the customers which include an 'a' at the beginning of their name should be displayed in the JTable. When the user enters a 'b' addtionally all users which fit the condition 'ab' are shown. Currently I requery the DB every time a key is pressed. But this is not very performant over the network. Is there a way to store a buffered ResultSet in RAM and make queries on this ResultSet?
    Thx

    ...but there must be a easier way to deal with it!Either you have all the data in the GUI or you don't. If you have it there then you have to get all of it. And then do something with it. If you don't get it all, then you are going to have to do a query each time. There is no other solution.
    You could do a partial solution, for example do the first query after they type the first letter and then after that handle the data yourself.
    (Keep in mind that this sort of GUI is 'really cool' but generally serves no pratical purpose particularily for large businesses. Day to day work doesn't support such usage.)

  • Search for strings inside html tags ?

    Is there any way to get Spotlight to find search strings inside html documents? One example is I want to find any file that includes a certain alt=" " string inside an img src tag.
    Spotlight does not seem to include anything inside html tags in it's search, as far as I can tell.
    Am I missing something? Is there something I need to do?
    Thanks for any ideas,
    KarenD
    G5   Mac OS X (10.4.4)  
    G5   Mac OS X (10.3.5)  

    Very strange--it does find text inside the html files, but indeed does not seem to have text that is in the file but only appears within a tag. The solution is EasyFind by Christian Grunenberg:
    http://www.grunenberg.com
    You can do a content search on files in a particular folder, which I recommend since it does a brute force search and can take awhile if it has to search everything.
    Francine
    Schwieder

  • Search for string and replace with frame break

    Hello there,
    We're using an InDesign CS6 Server for creating print data. The problem relates to our documents that consist of several connected text frames.
    Situation:
    The texts are exported from our database into InDesign via xml and so some automated editing in javascript. These texts contaion several paragraphs with headlines. Sometimes after the import the layout just looks bad, because the first textfield contains the fist paragraph and the headline of the second paragraph including some lines of text. Sometimes this behaviour is desired and sometimes not.
    Workaroud:
    We definde the string #*# to be our placeholder for line breaks. During the creation of the xml this string gets replaced by unicode for the hard line break (&#xA;).
    Desired Solution:
    This workaround has some disadvantages and we want our placeholder string to be translated to a frame break.
    Until now I have neither found any definition for the unicode translation of the frame break nor a script based solution that just replaces this string with a frame break. any help is appreciated.
    Regards

    Instend of define string add attribute in xml or DB
    e.g attribute name frame break="frame break"
    after that through find the attribute get the insertion ponint and apply "SpecialCharacters.FRAME_BREAK"

  • Search for String patterns in a Database table

    Hi
    There is a select statement using where condition with a like statement
    WHERE table1  <> 'JP'
                 AND (
                     ( field1 LIKE '%:%' OR field2 LIKE '%:%' )
          It fetches records where the field field1 or field2 has string:string as value where string is some set
    of   characters . What is  the equivalent of LIKE in se11 / se12 .
    Thanks in advance .
    Geethanjali

    Hello
    Try

  • Searching a String in Script

    Hi All,
    I need one help is there any provision to search for string in standard or customized scripts....for example to search a string in programs..through program RPR_ABAP_SOURCE_SCAN i can search in program...same way how can i search for a text in scripts ??
    Regards
    VEnk@

    Continue....
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
      STXL_ID-TDOBJECT = 'FORM'.
      STXL_ID-TDID = 'TXT'.
      SELECT * FROM STXL CLIENT SPECIFIED
              WHERE MANDT    = PA_MANDT
                AND RELID    EQ 'TX'
                AND TDOBJECT EQ 'FORM'
                AND TDID     EQ 'TXT'
                AND TDNAME   IN SO_NAME
                AND TDSPRAS  IN SO_SPRAS.
        MOVE-CORRESPONDING STXL TO I_STXL.
        APPEND I_STXL.
      ENDSELECT.
      SORT I_STXL.
      CLEAR HUIDIGE_TDSPRAS_TDNAME.
      CLEAR VORIGE_TDSPRAS_TDNAME.
      LOOP AT I_STXL.
        STXL_ID-TDNAME  = I_STXL-TDNAME.
        STXL_ID-TDSPRAS = I_STXL-TDSPRAS.
        STXL_ID-TDID    = I_STXL-TDID.
        CONCATENATE STXL_ID-TDSPRAS STXL_ID-TDNAME
                    INTO HUIDIGE_TDSPRAS_TDNAME.
        IF HUIDIGE_TDSPRAS_TDNAME <> VORIGE_TDSPRAS_TDNAME.
          CONCATENATE STXL_ID-TDSPRAS STXL_ID-TDNAME
                                      INTO VORIGE_TDSPRAS_TDNAME.
          REFRESH LINES.
          CLEAR H_TEL.
          IMPORT TLINE TO LINES FROM DATABASE STXL(TX)
                                     CLIENT   I_STXL-MANDT
                                     ID       STXL_ID.
          LOOP AT LINES.
            IF LINES-TDFORMAT = '/W'.
              H_WINDOW = LINES-TDLINE.
            ENDIF.
            SEARCH LINES-TDLINE FOR H_STRING1.
            IF SY-SUBRC <> 0 AND H_STRING2 <> SPACE.
              SEARCH LINES-TDLINE FOR H_STRING2.
            ENDIF.
            IF SY-SUBRC EQ 0 AND LINES-TDFORMAT NE '/*'.
              H_POS = SY-FDPOS.
              IF NOT PA_ITEM1 IS INITIAL.
                ADD 8 TO H_POS.
              ENDIF.
              IF NOT PA_ITEM4 IS INITIAL.
                ADD 11 TO H_POS.
              ENDIF.
              H_LEN = STRLEN( PA_STR ).
              H_STRING = LINES-TDLINE+H_POS(H_LEN).
              IF H_TEL EQ 0.
                HIDE I_STXL-MANDT.
                HIDE STXL-TDNAME.
                HIDE I_STXL-TDSPRAS.
                WRITE: /001 I_STXL-MANDT,
                        005 STXL-TDNAME HOTSPOT ON,
                        036 I_STXL-TDSPRAS,
                        041 H_WINDOW(30).

  • Search a String Vector for String

    I can't figure out why this won't work. It is supposed to search the id vector for stringValue. It does not return any compilation errors, it just simply won't match stringValue with the id.get(i) method.
            for ( int i = 0; i < id.size(); i++ )
              if ( stringValue == id.get(i) )
                JOptionPane.showMessageDialog( null, "Item already exist.", "Error", JOptionPane.ERROR_MESSAGE );
                stringValue = null;
            }

    "==" tests for object equality (i.e., that two variables contain the exact same object)
    "equals()" tests for object equivalence (i.e., that two objects have the same value, whether or not they are the same object)
    For strings, it's possible to have two different strings to contain the same sequence of characters. In this case, "==" returns false, while "equals()" returns true.

  • How do you search for a partial match in a vector table?

    Hi,
    I have a program that parses some table of mine into a vector table. It has a search function in the program that is intended to search the vector table for a specified keyword that the user enters. If a match is found, it returns true. If no match is found, false is returned.
    That part works great. However, I would like my program to search the vector table to try and find a PARTIAL match of the users entry, instead of looking for a complete match.
    Currently my program uses the Vector method 'contains(Object elem)' to find the complete matches and that part works great. It doesn't seem to work with partial matches. Either the exact syntax of the user's entry is in the table or it isn't.
    Hope I was clear enough. Any thoughts?
    Cheers,
    the sherlock

    You might find this code of interest. It uses the same commands as mentioned previously, but wraps them into a Comparator object. Note that you can't store elements with '*' in the Vector 'v' and that you must sort the elements with Collections.sort() beforehand.
    import java.util.*;
    class WildcardComparator implements Comparator
        public int compare(Object o1, Object o2)
         String string1 = (String)o1;
         String string2 = (String)o2;
         if(string2.indexOf("*") != -1) {
             // take off asterik
             return wildcardCompare(string1,
                           string2.substring(0, string2.length()-1));
         return string1.compareTo(string2);
        public int wildcardCompare(String s1, String key_s) {
         String s1substring = s1.substring(0, key_s.length());
         return s1substring.compareTo(key_s);
    public class wildcard
        public static void main(String[] args)
         Vector v = new Vector();
         v.add("coke");
         v.add("pepsi");
         v.add("7-up");
         v.add("a&w root beer");
         v.add("a&w cream");
         Collections.sort(v, new WildcardComparator());
         String key = "a&w*";
         int index = Collections.binarySearch(v,
                                  key,
                                  new WildcardComparator());
         if(index > 0)
             System.out.println("elem: " + v.get(index));
         else
             System.out.println("item not found");
         key = "c*";
         index = Collections.binarySearch(v,
                                  key,
                                  new WildcardComparator());
         if(index > 0)
             System.out.println("elem: " + v.get(index));
         else
             System.out.println("item not found");
    }

  • Urgent pls help!! How to search for an object in vectors?

    Hi,
    I heard that a Vector can store an object right?
    So lets say I created an object called Student that has the attributes: id, name, sex, age
    1) Is vector able to store many students with all these attributes? cos the examples i have seen so far vector only seems to store one attribute
    2) how do i search for sumthin in a vector? let's say i want to key in the student id or his name and find tt student's record to display it?
    thx!

    so sorry... apparantly i didnt copy the last few brackets..
    ===============================================================
    import java.io.*;
    import java.util.*;
    class AddReservation
         static BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
         //Main Method
         public static void main (String[]args)throws IOException
              String custName, comments;
              int covers, date, startTime, endTime;
              int count = 0;
              //User can only add one reservation at a time
              do
                   //Create a new reservation
                   Reservation oneReservation=new Reservation();                         
                   System.out.println("Please enter customer's name:");
                   System.out.flush();
                   custName = stdin.readLine();
                   oneReservation.setcustName(custName);
                   System.out.println("Please enter number of covers:");
                   System.out.flush();
                   covers = Integer.parseInt(stdin.readLine());
                   oneReservation.setCovers(covers);
                   System.out.println("Please enter date:");
                   System.out.flush();
                   date = Integer.parseInt(stdin.readLine());
                   oneReservation.setDate(date);
                   System.out.println("Please enter start time:");
                   System.out.flush();
                   startTime = Integer.parseInt(stdin.readLine());
                   oneReservation.setstartTime(startTime);
                   System.out.println("Please enter end time:");
                   System.out.flush();
                   endTime = Integer.parseInt(stdin.readLine());
                   oneReservation.setendTime(endTime);
                   System.out.println("Please enter comments, if any:");
                   System.out.flush();
                   comments = stdin.readLine();
                   oneReservation.setComments(comments);
                   count++;
              while (count<1);
              class Reservation
              private Reservation oneReservation;
              private String custName, comments;
              private int covers, startTime, endTime, date;
              //Default constructor
              public Reservation()
              public Reservation(String custName, int covers, int date, int startTime, int endTime, String comments)
                   this.custName=custName;
                   this.covers=covers;
                   this.date=date;
                   this.startTime=startTime;
                   this.endTime=endTime;
                   this.comments=comments;
              //Setter methods
              public void setcustName(String custName)
                   this.custName=custName;
              public void setCovers(int covers)
                   this.covers=covers;;
              public void setDate(int date)
                   this.date=date;
              public void setstartTime(int startTime)
                   this.startTime=startTime;
              public void setendTime(int endTime)
                   this.endTime=endTime;
              public void setComments(String comments)
                   this.comments=comments;
              //Getter methods
              public String getcustName()
                   return custName;
              public int getCovers()
                   return covers;
              public int getDate()
                   return date;
              public int getstartTime()
                   return startTime;
              public int getendTime()
                   return endTime;
              public String getComments()
                   return comments;
              //Display the current reservation
              //public void displayReservation()
         //          System.out.println(custName.getcustName());
         //          System.out.println(covers.getCovers());
         //          System.out.println(date.getDate());
         //          System.out.println(startTime.getstartTime());
         //          System.out.println(endTime.getendTime());
         //          System.out.println(comments.getComments());
    ===============================================================
    import java.io.*;
    import java.util.*;
    class searchBooking
         static BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
         public static void main (String[]args)throws IOException
              int choice, date, startTime;
              String custName;
                   //Search Menu
                   System.out.println("Search By: ");
                   System.out.println("1. Date");
                   System.out.println("2. Name of Customer");
                   System.out.println("3. Date & Name of Customer");
                   System.out.println("4. Date & Start time of reservation");
                   System.out.println("5. Date, Name of customer & Start time of reservation");
                   System.out.println("Please make a selection: ");          
                   //User keys in choice
                   System.out.flush();
                   choice = Integer.parseInt(stdin.readLine());
                   if (choice==1)
                        System.out.println("Please key in Date (DDMMYY):");
                        System.out.flush();
                        date = Integer.parseInt(stdin.readLine());
                   else if (choice==2)
                             System.out.println("Please key in Name of Customer:");
                             System.out.flush();
                             custName = stdin.readLine();
                   else if (choice==3)
                             System.out.println("Please key in Date (DDMMYY):");
                             System.out.flush();
                             date = Integer.parseInt(stdin.readLine());
                             System.out.println("Please key in Name of Customer:");
                             System.out.flush();
                             custName = stdin.readLine();
                   else if (choice==4)
                             System.out.println("Please key in Date (DDMMYY):");
                             System.out.flush();
                             date = Integer.parseInt(stdin.readLine());
                             System.out.println("Please key in Start time:");
                             System.out.flush();
                             startTime = Integer.parseInt(stdin.readLine());
                   else if (choice==5)
                             System.out.println("Please key in Date (DDMMYY):");
                             System.out.flush();
                             date = Integer.parseInt(stdin.readLine());
                             System.out.println("Please key in Name of Customer:");
                             System.out.flush();
                             custName = stdin.readLine();
                             System.out.println("Please key in Start time:");
                             System.out.flush();
                             startTime = Integer.parseInt(stdin.readLine());
              public void           
    }

Maybe you are looking for

  • New system, MSI X800XT PCI-E Issues

    Hi there! I just bought a new motherboard, new ram, new cpu and new videocard and was eagerly wanting to set this stuff up.   My system is now as follows: Motherboard: MSI 925X Neo-54G CPU: P4 3.40Ghz (1 Mb L2 Cache) (Socket 775) RAM: 1 GByte DDR2 53

  • Connecting to AT&T DSL gateway wirelessly

    I'm anxiously awaiting the arrival of my new MacBook Pro. Can't wait to trash my Dell! I have ordered AT&T DSL with a gateway. Is there any adapter or other equipment that I will need to purchase to connect My laptop to the internet wirelessly in my

  • Import Data from DMP file

    I export data and create a DMP file on daily basis I import data from this DMP to an other computer but some data import duplicate records. I want to aviod duplicate records what should I do

  • Passing different tables as a input parameter

    HI, I've 5 tables TAB1, TAB2, TAB3, TAB4, TAB5 and I created 5 store procedures to generate 5 file.txt with utl_file utility. Now I'd like to know if possible create just one stored procedure (or package) with just one cursor that passing different t

  • I am new to Photoshop Elements.  How can I see the exif data of my photograph?

    I am new to Photoshop Elements.  How can I see the exif data of a photo?