Hi
I am running a code of "Employee.java" ; It will return me Name,Salary and HireYear of employee.
CODE Of "Employee.java"
----------------------------------------------------------------------
package Comp;
public class Employee
{
private
String name;
private double salary;
private int hireYear;
public Employee ()
{
this("No Name",100,2000);
}
public Employee(String theName, int theSalary, int theHireYear)
{
name=theName;
salary = theSalary;
hireYear= theHireYear;
}
public String toString()
{
return "name\t" +name + "\t. salary is " +salary+"\t Hire Year is " + hireYear+ salary;
}
public void raiseSalary(int byPerc)
{
double perc = byPerc *0.01;
salary=(salary*perc) + salary;
}
public static void main(String[] args)
{
Employee
test = new Employee();
test.salary=100;
System.out.println(test.toString());
test.raiseSalary(10);
System.out.println(test.toString());
}
}
--------------------------------------------------------------------------
But When I am importing this file to "EmployeeTester.java"
It will displayed me only "name, & "hireyear".
Here is the code of "EmployeeTester.java"
-------------------------------------------------------------------------
public class EmployeeTester
{
public static void main (String[] args)
{
Employee e1= new Employee("B1",100.0,1998);
e1.raiseSalary(5);
System.out.println(e1.toString());
}
}
---------------------------------------------------------------------
Please help me... to find out where I went wroung
Thanks,
Divya