DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002

    Question Question - Help needed, please.

    I am trying to write a program that stores information about users. It will have thier name, a salary, vacation and sick days. I have using class inheritance for some of the information (i.e. name).

    Here is where I am stuck (and perhaps I am doing it all wrong, not really sure). I want to be able to prompt the user to input a employee ID number, I want the employee ID to match with the static infomation I have already put in, so I can display information about the person they want to know about. I also want to be able to add new names, and modify certain data on existing names (i.e. Vacation days, sick daya and salary.)

    can anyone tell me a way to get a person to input an ID number that can be converted or matched with all the information on a single user?

    Does this make sense at all? Some, any and all adivce as well as help would be greatly appreciated.

    "aut vincere, aut mori"

  2. #2
    Join Date
    Nov 2002
    How are you storing the data about your employees? The best way (IMHO) is an employee object with an id, name, etc... variables. Assuming there are not thousands of employees in your database, you should be able to create an array of these objects to store all the employees.
    Employee[] my_employees = new Employee[no_employees];
    Once the user has input the id, you can then loop through the array, checking the id value until you find the correct object with which you can access its variables.

    If you'd like more control over the number of employees and modifying them it might be best to use some other data structure (like a vector) other than an array. Post some of your code if you'd like more specifics.


  3. #3
    Join Date
    Nov 2002

    Smile Thanks

    Thanks for the reply,

    I think the array is what I needed. I just had not figured out how to work it, your answer I think is leading me in the right direction. I will continue to muddle through on this. Thanks again for the answer, it really helped.

    "aut vincere, aut mori"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.