Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   Need array help, desperately !! (http://www.programmingforums.org/showthread.php?t=14912)

bearvsgodzila Jan 10th, 2008 10:19 AM

Need array help, desperately !!
 
1 Attachment(s)
Hey there, currently i have a 1 week home/quiz some like that i quite lost on array which focuses on java OOP.

The program consist of 3 classes and 1 application to run it.

There are : Applicant , job and Agency class

i just finish doing 2 classes which is Applicant and Job class
Just the agency i not very sure how to do it. i will show below the two classes

:

public class Applicant{
        //attributes
        private String name;
        private String nric;
        private String qualification;
        private String field;
        private boolean available;
       
        //constructor
        public Applicant(String name, String nric, String qualification, String field, boolean available)
        {
        this.name = name;
        this.nric = nric;
        this.qualification= qualification;
        this.available= available;
        }
       
        //methods
        public String getName(){
        return name;
        }
       
        public void setAvailable(boolean a){
        available=a;
        }
       
       
        public String getNric(){
        return nric;
        }
       
        public String getQualification(){
        return qualification;
        }
       
        public String getfield(){
        return field;
        }
       
        public String toString()
        {
        String info="name: "+name+"\nnric: "+nric+"\nqualification:"+qualification+"/nfield:"+field;
        return info;
        }
}



Job Class

:

    public class job{
      private String job;
      private String title;
      private String company;
      private int numofVacancy;
      private String field;
      private String qualification;
      private String id;
 
      public job(String id,String job,String title,String company,int numofVacancy, String field,String qualification)
      {
        this.job=job;
        this.title=title;
        this.company=company;
        this.numofVacancy= numofVacancy;
        this.qualification= qualification;
        this.field=field;
        this.id=id;
      }
 
      public int computeCommission()
      {
        int commission = 0;
        if( qualification== "A level")
        {
            commission = 300;
        }
        else
        {       
            if(qualification == "diploma")
            {
              commission = 400;
            }
            else
            {
              if(qualification == "degree or higher")
              {
                  commission = 500;
              }
            }
        }
        return commission;
      }
 
      public String getId()
      {
        return id;
      }
      public String getJob()
      {
        return job;
      }       
 
      public String getTitle()
      {
        return title;
      }
 
      public String getCompany()
      {
        return company;
      }
      public int getNumofVacancy()
      {
        return numofVacancy;
      }
      public String getField()
      {
        return field;
      }
      public String getQualification()
      {
        return qualification;
      }
      public String toString()
      {
        String info = "job:"+job+"\ntitle:"+title+"\ncompany:"+company+"\nnumber of vacancy:"+numofVacancy+"\nfield:"+field+"\nqualification"+qualification;
        return info;
      }
 
  }


Gee can some1 who good at array kindly help me with sample code to let me understand how to check on duplicate applicant, return null, add and remove array. PLease help a newbie in java.

For you guys want to know what the program wants i have put the question in document 2003 for better understanding (attachment file below)

Thanks in Advance :)

null_ptr0 Jan 10th, 2008 4:04 PM

Re: Need array help, desperately !!
 
If I understood anything of what you said, I might have answered. Try to not talk in broken English.

bearvsgodzila Jan 11th, 2008 8:53 AM

Re: Need array help, desperately !!
 
I'm very sorry about the broken english, but i put the document in the attachment for further understanding, if in the thread you don't understand what i'm talking about .


No offence :$

domquem Jan 18th, 2008 6:53 AM

Re: Need array help, desperately !!
 
can u help a brother out! geeeezzzz!

grumpy Jan 18th, 2008 3:31 PM

Re: Need array help, desperately !!
 
Actually, domquem, we can't.

If you read the site rules, doing homework is against site rules. The attached document is homework, and he is asking us to adding parts of the solution that he has not done himself.

His question is also as clear as mud as well. Even if it wasn't homework, it is necessary to ask a clear question in order to get a clear answer.

mbd Jan 18th, 2008 3:45 PM

Re: Need array help, desperately !!
 
There is a class called ArrayList. The methods you are looking for are named:
1. contains - tell if applicant exists in the list
2. add - add an applicant to the list
3. remove - remove an applicant from the list

Please read that documentation and attempt to solve this on your own. The documentation is available in some languages other than english.


All times are GMT -5. The time now is 1:10 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC