How can i ask the user only once using Vectors?

What i am trying to do is get an index of a vector.
I know that i have to use the elementAt(int), but what i want to do is
make it so only one screen pops up instead of all 4 of them.
I just want to ask his custID and from there look up the users information from the Vector. I cant get rid of the variables in the public Employee (see Employee Class) or else i will not be able to get the other information (delete a JOptionPane and you will see what i am talking about). Dont worry about the int int the elementAt part. I figured that out already.
public class Employee {
// class constants
// Data fields
private String custName;
private String custAddress;
private double rate;
private int custID;
private double steve;
public Employee(int id, String name, String adress, double ra) {
custName = name;
custAddress = adress;
rate = ra;
custID = id;
public String toString() {
return "Customer ID: "+ custID + "Customer Name : " + custName +
"Customer Adrress" + custAddress + "rate: $" + rate ;
public int getBalls(){
return custID;
public String getBallsy(){
return custAddress;
public double getRate(){
return rate;
the other one...
package bars;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.util.*;
public class EmployeeApp {
//methods
private static int readInt (String prompt){
String numStr = JOptionPane.showInputDialog(prompt);
return Integer.parseInt(numStr);
private static double readDouble (String prompt){
String numStr = JOptionPane.showInputDialog(prompt);
return Double.parseDouble(numStr);
public static void main (String[] args){
//read and store the payroll data in an employee object
Vector programmers = new Vector();
for (int i = 0; i < 1; i++) {
Employee programmer =
new Employee(
readInt("Enter Customer ID: "),
JOptionPane.showInputDialog("Name: " ),
JOptionPane.showInputDialog("Address: "),
readDouble ("Enter hourly rate: ")
int steve = programmer.getBalls();
int bob = steve;
programmers.add(programmer);
System.out.println("here: " + steve);
System.out.println(programmers.toString());

A vector probably isn't your best bet. Try a Map, a TreeMap if you want them in order, otherwise a HashMap. Use new Integer(customerId).
Map custMap = new HashMap(20);
custId = readInt("Enter customer ID");
custIdI = new Integet(custId);
Employee emp;
if(custMap.contains(custIdI)) {
    emp = (Employess)custMap.get(custIdI);
    ... old employess
   } else {
    emp = new Employee(....);
    custMap.put(custIdI, emp);
   }If you use a vector you'll have to search it with a look of your own for a matching id.

Similar Messages

  • How can  I  restrain the user login portal once, in the same time ???

    Hi
    I need to restrain the user can't repeat to login portal ....
    to reduce portal loading
    How can I restrain the user login portal once, in the same time???
    Which attributs in Identity Manager or amconsole I can do it to restrain the user ??
    tks

    Does your portal support anonymous access? If so, make sure you are using the authlessanonymous mode. This mode only creates one session that is shared for all anonymous users. This is much more efficient than anonymous access, which creates a session for each anonymous user.
    I have no other recommendation for limiting users to a single login. In general, web applications do not behave like this. What if a user closes their browser without logging out? Does the user have to wait until the session times out in order to log back in again?
    The same thing is true for users that are mobile. If a user leaves their office without logging out and then attempts to log in with a laptop in the conference room, then access will be denied in your implementation. Users do not expect this type of limitation being built into the system.
    If you are having problems scaling, then you need to look at your architecture and perhaps add some more resources. Also, make sure you are making efficient use of the authlessanonymous access mode as stated above.
    - Jim

  • How can i change the user that open the rfc connection (sm58) from R/3?

    Hi all,
    i'd like to know how can i customize the user 'connecting' R/3 and BW, i mean: when i launch a data extraction a fixed user creates the rfc connection to BW (and i can see it from tcode sm58 in r/3), i need to use a different username so that it will come be more easy for me to reorganize the rfc queue in case of errors (we are doing some testing), it's possible to do something like this or everyone has to share the same user r/3 side?
    I hope i've been clear...
    thanks for the help
    S.

    Hi...
    Its recommended that only one user executes the RFC because you must manage the authorizations for remote execution only with few users....in case on error you can send the user as a parameter of the RFC  and you can buid the error message with this parameter and identify the user of execution...
    I hope this helps you
    Regards

  • How Can i Block the Work Center Once is used in Maintainence Order

    Dear Experts,
    How Can i Block the Work Center Once is used in Maintainence Order in PM module.
    In standard its not blocking the Work Center automatically. How this can be achieved.
    Regards
    Raghu
    Edited by: raghu m on Apr 21, 2009 10:36 AM

    Hi Muthukumar,
    1. You can using the user exit or BADI to control this.
    CONFPP01            PP order conf.: Determine customer specific default values           
    CONFPP02            PP order conf.: Customer specific input checks 1                     
    CONFPP03            PP order conf.: Cust. specific check after op. selection             
    CONFPP04            PP order conf.: Customer specific input checks 2                     
    CONFPP05            PP order conf.: Customer specific enhancements when saving           
    CONFPP06            PP Order Confirmations: Actual Data Transfer                         
    CONFPP07            Single Screen Entry: Inclusion of User-Defined Subscreens            
    BADI
    WORKORDER_CONFIRM
    the above are the user exits that are available fro the CO11N tcode.
    2. we have to take a help of the abaper to write coding fort his.
    3. The user exit should be called for the
    Work Center : YYYYY
    then check the relevant Work Center Once is used in open Maintainence Order and if it has a entry if then give a error message else allow the CO11N to perform.
    Regards,
    Sankaran

  • How can I populate the users in the Directory Server?

    Hi all,
    I'm a new of Sun ONE Directory Server 5.2, I've just install a copy of it on Win2000 server and I have a small question to ask.
    How can I populate the users (This user can be use to login in to Sun ONE install messenger) in the Directory Server using the Directory server's admin console?
    Thanks in advance,
    Tuan Anh,

    Thanks Ramnath,
    I've read your suggest, but actually, I really wanted to know how to populate user and password. I've read some thing below in Sun ONE Directory 5.2 Getting Started Guide.pdf
    � o=userRoot
    During installation, a user database is created by default. The default name of
    the user database is o=userRoot. You can choose to populate this database at
    installation, or to populate it later.
    But I don�t know the related document, I have create successful user and pass by using admin console. But can not user this user to login in to Instant messenger.
    I'm looking forward to receive your help
    Tuan Anh

  • HT201342 How can I change the USER of my i-cloud address? My 12 year old set up the e-mail account and used a silly user name (like: turtle!!). I would like to have an icloud e-mail account but under my own user name. The other /old name can be deleted?

    How can I change the USER name of my i-cloud e-mail account? It was set up by my son and he used a silly / embarrassing user name. I would like to change this name OR set up another i-cloud e-mail account under my own name / reference. Help?

    iCloud email addresses can't be changed or deleted, but you can set up an alias namethat he can use which will be linked to his current iCloud account and will receive email in the existing iCould inbox.  This guide explains how: http://support.apple.com/kb/PH2622.

  • The Ipad2 Application Data folder is taking up huge space in C: Drive. How can I shift the User Application data for iPad2 to another Drive?

    The Ipad2 Application Data folder is taking up huge space in C: Drive. How can I shift the User Application data for iPad2 to another Drive?

    Thanks a lot for the response. Yes, I am checking my C: drive data thoroughly now, including the hidden folders, to ascertain if something else can be moved, as per your suggestion.

  • How can i receive the user name of the present operating system

    HI,all.
    how can i receive the user name of the present operating system from SAP.Have any funciton to use?Thankyou!

    use sy-uname system field.
    report ztest.
    write:sy-uname.
    thanks.
    reward if solved.

  • How can I find the USer Exit...

    Hi,
    How can I find the USer Exit...
    I need to do changes for this User Exit :EXIT_SAPLKEII_002
    In which T-code I can open this Exit
    Ex: Go to some Transcation code and then give the name of the Exit ato access this Exit
    ...any sugesstions will be apprecaited!
    Thanks & Regards,
    Kittu

    Hi,
        the EXIT : EXIT_SAPLKEII_002 is the exit,in this SAPLKEII is the standard Program.Copy this program and go to transactio SE38 and press Enter and then go for the option Where used list and check the check box Transaction. It displays the possible Transactions that the Exit triggers
    Regards,
    Vijaya Lakshmi.T

  • How can i change the user on FaceTime? im trying to do this on a iMac

    how can i change the user on FaceTime? im trying to do this on a iMac

    I'm using an iMac with OSX 10.6.8.  The proceedure on your system is probably similar.
    Get the Facetime window up, and go to Facetime preferences.  Click on "account,"  you'll see a view account option that will prompt you to sign in with your Apple id and password.  From there you can make the changes that you want.

  • How can we restrict the users/planners for a planning book?

    Hi experts,
    How can we restrict the users/planners for a planning book?
    Thanks,
    Naga.

    Hi Naga,
    we describe this in our SAP Demand and Supply Network Planning rapid-deployment solution.
    Access this area directly via
    http://service.sap.com
    /rds-dpa
    In the configuration guide Demand Planning Settings, Macros and Chart
    Engine (DP3) read Appendix: Setting up Roles and
    Authorizations.
    BR Frank

  • How Can I record the user's logging time?

    How Can I record the user's login time?I create a table containing some column such as record_id,username,start_time,end_time,period.How can I create a process on logging in to record the start_time and a process on logging out to record the end_time?
    Thanks for any help.

    you can refer to the name of the currently logged in user using :APP_USER. to capture the login info, i'd add an htmldb process to my app that fired "After Authentication" and simply inserted :APP_USER and sysdate into my logging table. for the logout case, you could change the "Logout URL" of your current authentication scheme to one that does whatever it's currently doing plus the logging. so i Logout URL of...
    wwv_flow_custom_auth_std.logout?p_this_flow=&APP_ID.&p_next_flow_page_sess=&APP_ID.:101:&APP_SESSION.
    ...and i changed it to something like...
    my_schema_name.my_logout?p_user=&APP_USER.&p_app=&APP_ID.&p_session=&APP_SESSION.
    ...where my_logout was...
    create or replace procedure my_logout(
    p_user in varchar2,
    p_app in varchar2,
    p_session in varchar2) as
    begin
    insert into my_logging_table values (sysdate, 'logged out as '||p_user);
    wwv_flow_custom_auth_std.logout (
    p_this_flow => p_app ,
    p_next_flow_page_sess => p_app||':101');
    end;
    ...and things worked fine.
    hope this helps,
    raj

  • How can I change the user's neme in Sidebar

    how can I change the user's neme in Sidebar

    same here "i cant change the text iether"
    new i movie user on new mac book pro 

  • I'm using "window.open()" to show one Calendar in a popup window. I can see that the popup is re-sizable. How can I prevent the user from re-sizing the popup?

    I'm using "window.open()" to show one Calendar in a popup window. I can see that the popup is re-sizable. How can I prevent the user from re-sizing the popup? I have tried "resizable=yes|no|1|0" and that seems to be not working.

    You can't prevent users from resizing a pop-up.
    *https://developer.mozilla.org/en-US/docs/Web/API/window.open

  • I have two apple id's because my hotmail account is no longer active. How can I delete the old one and use or update the new one?  Every time I try it won't allow me and now my iPad thinks there are two accounts and they are arguing with each other. Help!

    I have two apple id's because my hotmail account is no longer active. How can I delete the old one and use or update the new one?  Every time I try it won't allow me and now my iPad thinks there are two accounts and they are arguing with each other. Help!

    You can't merge accounts or copy content to a different account, so anything that you bought or downloaded via the old account is tied to that account - so any updates that those apps get you will only be able to download via that account. You can change which account is logged in on the iPad via Settings > Store

Maybe you are looking for