who can help me in java?

this is my code:
//employee.java
public class Employee
{
String emp_id;
String emp_name;
String emp_icno;
char emp_gender;
String emp_dob;
String emp_addr;
String emp_comDate;
String emp_dept;
String emp_pos;
double emp_sal;

public Employee()
{
emp_id = "99999";
emp_name = "";
emp_icno="";
emp_gender='m';
emp_dob="";
emp_addr="";
emp_comDate="";
emp_dept="";
emp_pos="";
emp_sal=0;
}

public void setEmp_id(String aId)
{
emp_id=aId;
}

public String getEmp_id()
{
return emp_id;
}

public void setEmp_name(String aName)
{
emp_name=aName;
}

public String getEmp_name()
{
return emp_name;
}

public void setEmp_icno(String aIcno)
{
emp_icno=aIcno;
}

public String getEmp_icno()
{
return emp_icno;
}

public void setEmp_gender(char aGender)
{
emp_gender=aGender;
}

public char getEmp_gender()
{
return emp_gender;
}

public void setEmp_dob(String aDob)
{
emp_dob=aDob;
}

public String getEmp_dob()
{
return emp_dob;
}

public void setEmp_addr(String aAddr)
{
emp_addr=aAddr;
}

public String getEmp_addr()
{
return emp_addr;
}

public void setEmp_comDate(String aComDate)
{
emp_comDate=aComDate;
}

public String getEmp_comDate()
{
return emp_comDate;
}

public void setEmp_dept(String aDept)
{
emp_dept=aDept;
}

public String getEmp_dept()
{
return emp_dept;
}

public void setEmp_pos(String aPos)
{
emp_pos=aPos;
}

public String getEmp_pos()
{
return emp_pos;
}

public void setEmp_sal(double aSal)
{
emp_sal=aSal;
}

public double getEmp_sal()
{
return emp_sal;
}
}
-------------------------------------------------------------------
EmployeeDb.java
import java.io.*;

public class EmployeeDb extends Employee
{
public static void main(String Args[]) throws IOException
{

Employee[]empRec=new Employee[3];
System.out.println("Enter a name");

//for(int i=0;i<empRec.length;i++)
//{
//empRec=new Employee();
//System.out.println("enter a name");
//empRec.setEmp_name.System.in.read();
//}


for(int i=0;i<empRec.length;i++)
{
System.out.println(empRec.getEmp_id());
System.out.println(empRec.getEmp_name());
System.out.println(empRec.getEmp_icno());
System.out.println(empRec.getEmp_gender());
System.out.println(empRec.getEmp_dob());
System.out.println(empRec.getEmp_addr());
System.out.println(empRec.getEmp_comDate());
System.out.println(empRec.getEmp_dept());
System.out.println(empRec.getEmp_pos());
System.out.println(empRec.getEmp_sal());
}
}
}

i want to prompt user to enter three employee's information from the console and store data in an array...
id number is set to 99999...
i can key in but the mutator(set) cannot bring to the accesor(get)....
how to code it to enter the information...
thanks....

MissingCodeTagError, redo from start.

MissingCodeTagError, redo from start.

what ur meant? i don know leh..

Put "[code] your code here [/code]"

[code]

// your code here

[/code]

[code]

// your code here

[/code]

i really don understand what ur meant...
can u give some example...
TQ

public class AskedExample{
   public static void main(String args[]){
           System.out.println("enter your code here");
   }

}

is the same as:

[|CODE]
public class AskedExample{
public static void main(String args[]){
System.out.println("enter your code here");
}

}
[|/CODE]

without the '|'s
if you want us to check out your code, we would want it to appear a little formatted and readable

i really don understand what ur meant...
can u give some example...
TQ

It means type a left bracket, then type the word code, then a right bracket, then hit enter, then paste your code, then hit enter, then type
[/code]. So this:

//employee.java
public class Employee
{
String emp_id;
String emp_name;
String emp_icno;
char emp_gender;
String emp_dob;
String emp_addr;
String emp_comDate;
String emp_dept;
String emp_pos;
double emp_sal;


turns into this:

//employee.java
public class Employee
{
String emp_id;
String emp_name;
String emp_icno;
char emp_gender;
String emp_dob;
String emp_addr;
String emp_comDate;
String emp_dept;
String emp_pos;
double emp_sal;

You can also do this:

[code=JAVA] <--- add =JAVA //employee.java public class Employee { String emp_id; String emp_name; String emp_icno; char emp_gender; String emp_dob; String emp_addr; String emp_comDate; String emp_dept; String emp_pos; double emp_sal;

[/code]
and it'll look like this (Java style)

//employee.java
public class Employee
{
String emp_id;
String emp_name;
String emp_icno;
char emp_gender;
String emp_dob;
String emp_addr;
String emp_comDate;
String emp_dept;
String emp_pos;
double emp_sal;

actually my problem is when i key in the information but it cannot get that value i key in to return in mutator(set) and display....in array

actually my problem is when i key in the information but it cannot get that value i key in to return in mutator(set) and display....in array

Well here's your code in a more readable format, run through a beautifier and with code tags:

//employee.java
public class Employee
{
    String emp_id;
    String emp_name;
    String emp_icno;
    char emp_gender;
    String emp_dob;
    String emp_addr;
    String emp_comDate;
    String emp_dept;
    String emp_pos;
    double emp_sal;
    
    public Employee()
    {
        emp_id = "99999";
        emp_name = "";
        emp_icno="";
        emp_gender='m';
        emp_dob="";
        emp_addr="";
        emp_comDate="";
        emp_dept="";
        emp_pos="";
        emp_sal=0;
    }
    
    public void setEmp_id(String aId)
    {
        emp_id=aId;
    }
    
    public String getEmp_id()
    {
        return emp_id;
    }
    
    public void setEmp_name(String aName)
    {
        emp_name=aName;
    }
    
    public String getEmp_name()
    {
        return emp_name;
    }
    
    public void setEmp_icno(String aIcno)
    {
        emp_icno=aIcno;
    }
    
    public String getEmp_icno()
    {
        return emp_icno;
    }
    
    public void setEmp_gender(char aGender)
    {
        emp_gender=aGender;
    }
    
    public char getEmp_gender()
    {
        return emp_gender;
    }
    
    public void setEmp_dob(String aDob)
    {
        emp_dob=aDob;
    }
    
    public String getEmp_dob()
    {
        return emp_dob;
    }
    
    public void setEmp_addr(String aAddr)
    {
        emp_addr=aAddr;
    }
    
    public String getEmp_addr()
    {
        return emp_addr;
    }
    
    public void setEmp_comDate(String aComDate)
    {
        emp_comDate=aComDate;
    }
    
    public String getEmp_comDate()
    {
        return emp_comDate;
    }
    
    public void setEmp_dept(String aDept)
    {
        emp_dept=aDept;
    }
    
    public String getEmp_dept()
    {
        return emp_dept;
    }
    
    public void setEmp_pos(String aPos)
    {
        emp_pos=aPos;
    }
    
    public String getEmp_pos()
    {
        return emp_pos;
    }
    
    public void setEmp_sal(double aSal)
    {
        emp_sal=aSal;
    }
    
    public double getEmp_sal()
    {
        return emp_sal;
    }
}
-------------------------------------------------------------------
EmployeeDb.java
import java.io.*;

public class EmployeeDb extends Employee
{
    public static void main(String Args[]) throws IOException
    {
        
        Employee[]empRec=new Employee[3];
        System.out.println("Enter a name");
        
        //for(int i=0;i&lt;empRec.length;i++)
        //{
            //empRec[i]=new Employee();
            //System.out.println("enter a name");
            //empRec[i].setEmp_name.System.in.read();
        //}
        
        
        for(int i=0;i&lt;empRec.length;i++)
        {
            System.out.println(empRec[i].getEmp_id());
            System.out.println(empRec[i].getEmp_name());
            System.out.println(empRec[i].getEmp_icno());
            System.out.println(empRec[i].getEmp_gender());
            System.out.println(empRec[i].getEmp_dob());
            System.out.println(empRec[i].getEmp_addr());
            System.out.println(empRec[i].getEmp_comDate());
            System.out.println(empRec[i].getEmp_dept());
            System.out.println(empRec[i].getEmp_pos());
            System.out.println(empRec[i].getEmp_sal());
        }
    }
}

how to code it to enter the information...
thanks....

well... part of it is correct, but make sure you are reading what you think you are reading.
as far as I can tell, you tried this:

empRec.setEmp_name.System.in.read();

for an object of the class Employee, you are trying to call the method setEmp_name, but you are doing it in a wrong way.
if you want to call a method, you should do the following:

Object.MethodName(methodArguments);

not

Object.MethodName.methodArguments;

secondly, you are expecting your main method to read a String object containing the name of the employee (which you enter manuallly)

but the method System.in.read(); does not return a String-Object, but an integer primitive

well... part of it is correct, but make sure you are reading what you think you are reading.
as far as I can tell, you tried this:

empRec.setEmp_name.System.in.read();

for an object of the class Employee, you are trying to call the method setEmp_name, but you are doing it in a wrong way.
if you want to call a method, you should do the following:

Object.MethodName(methodArguments);

not

Object.MethodName.methodArguments;

secondly, you are expecting your main method to read a String object containing the name of the employee (which you enter manuallly)

but the method System.in.read(); does not return a String-Object, but an integer primitive

i know...
but cannot run...
what i want to do to key in and return the value...
can u tell me...

Have you added the changes to your code? If you have what errors do you get know and what is your problem? Perhaps you should post you newly updated code and tell us in what you are having difficulties

well for starters your emp_pos is null also you a_pos isnt defined as anything so try

a_pos = "lol";

emp_pos = a_pos;

then see if that works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.