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           
}

Similar Messages

  • "urgent" pls help: How to remove name space form message in call to WS

    Hi
    I am calling a WS from my BPEL process. In the BPEL process I call the WS by referring to the URI of the WS in the partner link. The process works fine. But I have a problem with the message size. The WS does not accept Message size greater than 16kB.
    But my message some time exceeds 16kB when maximum data is handled in the message.
    Now I found that the each element in the request contains the namespace which eats up a lot of space.
    Is there a way to remove the namespace from individual elements and put it in a common place in the file? This would reduce the file size.
    I would like to bring to your notice that the WSDL of the WS that I am referring to does not have any reference of xsd. And also no XSD has been created in my BPLE process for this WS.
    Present message
    <messages>
    <InvokeCallORSNewHI_HELLO_InputVariable>
    <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="parameters">
    <HELLO xmlns:ns1="http://abc.def.com/webservices/" xmlns="http://abc.def.com/webservices/">
    <ns1:HELLO_DATA>
    <ns2:HI_TW xmlns:ns2="http://abc.def.com/webservices/packets">
    <ns3:IDENT xmlns:ns3="http://abc.def.com/webservices/fields">400001102/T1-TW17902</ns3:IDENT>
    <ns3:HI xmlns:ns3="http://abc.def.com/webservices/fields">400001102/T1</ns3:HI>
    <ns3:START_DATE xmlns:ns3="http://abc.def.com/webservices/fields">20080404</ns3:START_DATE>
    <ns3:START_TIME xmlns:ns3="http://abc.def.com/webservices/fields">0800</ns3:START_TIME>
    <ns3:DURATION xmlns:ns3="http://abc.def.com/webservices/fields">1200</ns3:DURATION>
    <ns3:WINDOW_COST xmlns:ns3="http://abc.def.com/webservices/fields">1.113</ns3:WINDOW_COST>
    <ns3:LATE_COST xmlns:ns3="http://abc.def.com/webservices/fields">1.75</ns3:LATE_COST>
    </ns2:HI_TW>
    </ns1:HELLO_DATA>
    </HELLO>
    </part>
    </InvokeCallORSNewHI_HELLO_InputVariable>
    </messages>
    Expected------------
    <HELLO xmlns:ns1="http://abc.def.com/webservices/" xmlns="http://abc.def.com/webservices/">
    <ns1:HELLO_DATA>
    <ns2:HI_TW>
    <ns3:IDENT>400001102/T1-TW17902</ns3:IDENT>
    <ns3:HI>400001102/T1</ns3:HI>
    <ns3:START_DATE>20080404</ns3:START_DATE>
    <ns3:START_TIME>0800</ns3:START_TIME>
    <ns3:DURATION>1200</ns3:DURATION>
    <ns3:WINDOW_COST>1.113</ns3:WINDOW_COST>
    <ns3:LATE_COST>1.75</ns3:LATE_COST>
    </ns2:HI_TW>
    </ns1:HELLO_DATA>
    </HELLO>
    Thanks
    Buddhadev

    Dear Rico
    Thanks for replying.
    Which XSD are you refering to ;
    Is it process XSD or the XSD created for the called WSDL.
    As I have stated, no XSD has been created for the Consumed WS. And no XSD reference is present in the WSDL of the WS consumed by me.
    Please confirm
    Thanks a lot
    Buddhadev

  • HT201359 Why i have been billed six times for the same item? Pls help how to refund..

    Why i have been billed six times for the same item? Pls help how to refund..

    Did you change your card details on your account a number of times when trying to purchase the item, and five of them are temporary store holding charges : http://support.apple.com/kb/HT3702 ?
    If they are all 'proper' charges then try the 'report a problem' link to contact iTunes Support : http://reportaproblem.apple.com
    If the 'report a problem' link doesn't work then you can try contacting iTunes Support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • Pls help - How can I add a typekit font to muse?

    As Muse doesn't come with all typekit fonts already included in the dropdown list of webfonts, I'd like to know how I can add a typekit font to the dropdown menu so I can use it for my website. I have Adobe creative cloud membership.
    I've searched the whole of the web and can't find anything about this at all - only about adding one of the existing muse typekit fonts which I already know how to do.
    Why doesn't Adobe include all typekit fonts with Muse when you're already a full creative cloud subscriber?

    Done!
    Date: Thu, 20 Dec 2012 03:13:17 -0700
    From: [email protected]
    To: [email protected]
    Subject: Pls help - How can I add a typekit font to muse?
        Re: Pls help - How can I add a typekit font to muse?
        created by morgan_in_london in Help with using Adobe Muse - View the full discussion
    You're very welcome - can I be cheeky and ask for a "correct answer" to be noted? :^D
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4935814#4935814
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4935814#4935814
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4935814#4935814. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Help with using Adobe Muse by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • How to search for file in jsp page

    i need help on how to search for a file in a folder where there is a lot of subfolder.like how u search in a document in windows. i need a complete codes in jsp page.
    thank you in advance.
    Message was edited by:
    n_dilah

    no i need to do a search engine in jsp page which is the j2ee.
    i type smth than tat file from any folder will appear the same way when u need to search your file in a document in windows.
    well can u nice people tell me where i can get the codes bcos i stinks when it come to programming.
    thank you very very very much.

  • How to search for a particular word in a string?

    How to search for a particular word in a string?
    thanks for your help....

    This works fine.
    public class Foo {
        public static void main(String[] args) {
        String s = "Now is the time for all good...";
        String s2 = "the time";
        System.out.println(s.contains(s2));
        System.out.println(s.contains("for al"));
        System.out.println(s.contains("not here"));
    }output:true
    true
    falseYou must have something else wrong in your code.
    JJ

  • How to search for password policy

    Hello,
    Using DS 5.2:
    I've created a test policy, dn: cn=Test Policy,ou=People, o=xxx, o=isp. I can apply the policy, I can see the policy in my backup ldifs, but I can't figure out how to search for and display it (and eventually, delete it) either from the command line using ldapsearch or form within the admin gui. Any help?

    What I would like to do is query my 8i instance for the current password policy
    Can anyone provide a query to retrieve this info?connect as sys
    in Oracle 8i and issue the command;
    select object_name,object_type from all_objects where object_name like '%PASS%';
    and
    select object_name,object_type from all_objects where object_name like '%POLICY%';
    I think , i'm not sure these policies would be transfered to 10g through migration except -if any- some of them are obsolete to 10g!!!!!
    Regards,
    Simon

  • How to search for upper/lower case using string using JAVA!!!?

    -I am trying to write a program that will examine each letter in the string and count how many time the upper-case letter 'E' appears, and how many times the lower-case letter 'e' appears.
    -I also have to use a JOptionPane.showMessageDialog() to tell the user how many upper and lower case e's were in the string.
    -This will be repeated until the user types the word "Stop". 
    please help if you can
    what i have so far:
    [code]
    public class Project0 {
    public static void main(String[] args) {
      String[] uppercase = {'E'};
      String[] lowercase = {'e'};
      String isOrIsNot, inputWord;
      while (true) {
       // This line asks the user for input by popping out a single window
       // with text input
       inputWord = JOptionPane.showInputDialog(null, "Please enter a sentence");
       if ( inputWord.equals("stop") )
        System.exit(0);
       // if the inputWord is contained within uppercase or
       // lowercase return true
       if (wordIsThere(inputWord, lowercase))
        isOrIsNot = "Number of lower case e's: ";
       if (wordIsThere(inputword, uppercase))
         isOrIsNot = "number of upper case e's: ";
       // Output to a JOptionPane window whether the word is on the list or not
       JOptionPane.showMessageDialog(null, "The word " + inputWord + " " + isOrIsNot + " on the list.");
    } //main
    public static boolean wordIsThere(String findMe, String[] theList) {
      for (int i=0; i<theList.length; ++i) {
       if (findMe.equals(theList[i])) return true;
      return false;
    } // wordIsThere
    } // class Lab4Program1
    [/code]

    So what is your question? Do you get any errors? If so, post them. What doesn't work?
    And crossposted: how to search for upper/lower case using string using JAVA!!!?

  • HT204266 how to search for a specific app eg tetris in the app store?

    Hi is there anyone that can please help me on how to search for a specific app eg tetris in the app store? Thanks

    Hi Friend,
    You just write down the name of the app or for what the app is used for (eg, write down Notes and then will appear a lot of options), then download what you wish.
    Hope it will be helpful

  • HT4623 I cannot see sw update button in general section,pls help how to update iOS in my iPad 2

    Hi I want to upgrade my iOS to 5 in my ipad2 but I cannot see nay upgrade button in the setting section.pls help how to upgrade my iOS now

    The Settings > General > Software Update option only appears when you have iOS 5+ installed, as you have iOS 4 you can only update to iOS 7 (that is the only version that you can update to) via your computer's iTunes, as described half-way down the page that you posted from. You will need the current version of iTunes on your computer : http://www.apple.com/itunes/download/
    Connect the iPad to your computer's iTunes and copy any purchases off the iPad to your computer via File > Devices > Transfer Purchases. You may also want to copy photos and any important documents off the iPad as well e.g. via the file sharing section at the bottom of the device's apps tab when connected to iTunes, via wifi, email, dropbox etc - they should be included in the backup, but it's best to have a copy of them outside of the backup just in case. You can then force a backup of the iPad via File > Devices > Back Up
    Then start the update by selecting the iPad on the left-hand sidebar, and on the Summary tab on the right-hand side clicking the Check For Updates button
    Updating to iOS 5+ : http://support.apple.com/kb/HT4972
    If you do update you can't then uninstall it

  • Hi, since i updated my iphone5 to 7.1 version,i found the battery easy run out,pls help how to back to 7.0.2 version,thanks

    since i updated my iphone5 to 7.1 version,i found the battery easy run out,pls help how to back to 7.0.2 version,thanks

    Downgrading of iOS is not supported by Apple.
    However, See these steps for troubleshooting battery or charging issues.

  • How to search for packages that Names including "'" [solved]

    Hi everyone
    first ,forgive my english lvevel
    and I want to know
    How to search for packages that Names including "'"
    for instance
    $ pacman -Ss America's Army
    it returned
    >
    Please help me ,many thanks!
    Last edited by icywalk (2010-04-05 13:09:26)

    fyi America's Army in the AUR as armyops if you're looking for it.

  • Pls help+how 2 extend warranty online 4 my iphone in india

    pls help+how 2 extend warranty online 4 my iphone in india

    If you area able to purchase Apple Care, then you could extend it one additional year, but you could not extend it 2 years. Check with Apple for your location to see if Apple Care can be purchased in your location. You would have had to purchase the device new from Apple or an authorized Apple reseller.

  • My iphone5 was stolen.. pls help how to deactivate it? badly need your help..

    My iphone5 was stolen.. i was slept on the bus, pls help how to deactivate it? badly need your help.. its only two months on me

    What To Do If Your iDevice Is Lost Or Stolen
    If you activated Find My Phone before it was lost or stolen, you can track it only if Wi-Fi is enabled on the device. What you cannot do is track your device using a serial number or other identifying number. You cannot expect Apple or anyone else to find your device for you. You cannot recover your loss unless you insure your device for such loss. It is not covered by your warranty.
    If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should have done in advance - before you lost it or it was stolen - and some things to do after the fact. Here are some suggestions:
    This link, Re: Help! I misplaced / lost my iPhone 5 today morning in delta Chelsea hotel downtown an I am not able to track it. Please help!, has some good advice regarding your options when your iDevice is lost or stolen.
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T. Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. What to do if your iOS device is lost or stolen
      6. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      7. Find My iPhone
      8. Report Stolen iPad | Stolen Lost Found Online
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on iCloud
      3. OS X Lion/Mountain Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)

  • How to search for a BADI in a transaction

    Hi All,
    Please let me know the steps to find a BADI for a transaction.
    Thanks,
    Jaffer Ali.S

    check this.
    u can find BADI's in different ways...
    1>First go to any transaction->iN THE menu bar SYSTEM->STATUS->Get the program name ->double click->u will go to the program attached to the tcode.Now search term will be CALL CL_EXITHANDLER.Now u will get list of BADI'S available..
    2>Goto SE24->Give class name as CL_EXITHANDLER->Display->double click on get_instance mathod->Now u will go inside the method->Now put break point on the cl_exithandler.Now go to any transaction code and pass dat..U will see that it will be stopped on the break point which u set on the cl_exithandler...In the exit name u can find list of badi's attached to the tcode..
    There are multiple ways of searching for BADI.
    • Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
    • Finding BADI Using SQL Trace (TCODE-ST05).
    • Finding BADI Using Repository Information System (TCODE- SE84).
    1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.
    Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI’s will be listed.
    The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.
    2. Start transaction ST05 (Performance Analysis).
    /people/alwin.vandeput2/blog/2006/04/13/how-to-search-for-badis-trace-it
    3. Go to “Maintain Transaction” (TCODE- SE93).
    Enter the Transaction VD02 for which you want to find BADI.
    Click on the Display push buttons.
    Get the Package Name. (Package VS in this case)
    Go to TCode: SE84->Enhancements->Business Add-inns->Definition
    Enter the Package Name and Execute.
    Here you get a list of all the Enhancement BADI’s for the given package MB.
    The simplese way for finding BADI is
    1. chooes Tcode Program & package for that Tcode.
    2. Go to Tcode se18
    3. Press F4
    4. search by package or by program.
    Regards
    Kiran Sure

Maybe you are looking for

  • Shared Apple ID - How do I set up a new ID but not lose any of my apps

    Hi there, My wife and I have been sharing an Apple ID ever since she got here first iPod Touch (version 1).  She asked me to set up the Apple ID in her name as she didn't feel comfortable with iTunes and setting everything up.  When I bought my first

  • Question about JDBC in BlazeDS?

    stupid question: is their a JDBC driver already installed with BlazeDS? I am currently installing BlazeDS in tomcat. Do i need to install the connector j separately, or does this come with BlazeDS? thanks

  • Editable & Dynamic ALV

    Hi, I have the situation where I want to create an editable ALV whose column fields will be known during run time. So, here I'm using Dynamic Internal table concept. Let me give a picture how my present program works, Inside the fieldcatalog, ifc I h

  • Can we make proxies for third party

    hey guys i m just a bit confused between adapters and proxies,is it possible to create proxies for any third party system(e.g. Oracle),if not then do proxies come into play only for SAP WAS 6.0 and higher or there is some other place too where we can

  • -Error: could not open `C:\Program Files\Java\j2re1.4.0_02\lib\i386\jvm.cf

    Using the classpath switch (as advised to an earlier topic message) doesn't work for me. Can you help?! Many thanks N