Results 1 to 4 of 4
Thread: cannot find symbol contructor
- 01-18-2010, 09:09 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 7
- Rep Power
- 0
cannot find symbol contructor
import java.text.*;
public class Employee {
private String name;
private double salary;
private double bonus;
private double tax;
public Employee( String name, double salary) {
setSalary(name,salary);
}
private void setSalary(String n, double sly){
name = n;
salary = sly;
}
public String getName() {
return name;
}
public double getSalary() {
return salary;
}
public double getBonus() {
return bonus;
}
public double getTax() {
return tax;
}
public double getTotal() {
return salary*(bonus/100)*((100-tax)/100);
}
public String toString() {
return "\n\nName - " + getName() +
"\nSalary - " + getSalary() +
"\nBonus - " + getBonus() +
"\nTax - " + getTax() +
"\nSalary - " + getSalary();
}
}
public class EmployeeTest {
public static void main (String args [] ) {
Employee myEmployee = new Employee();
myEmployee.setName("Choo Lee Lee");
myEmployee.setSalary(5000);
System.out.println( name + "'s is RM" + salary );
myEmployee.setBonus(10);
System.out.println( "The bonus is " + bonus + "%" );
myEmployee.setTax(5);
System.out.println( "The tax is " + tax + "%" );
System.out.println( "The final salary of " + name + " is RM" + total);
}
}
can someone please check for me why the red part was under the error "cannot find symbol constructor Employee()".
Thanks
I am a beginner.
- 01-18-2010, 10:34 AM #2
You are having constructor which accepts parameters.But,you are trying to call without passing any value.Thats why the error.
Ramya:cool:
- 01-18-2010, 03:24 PM #3
Member
- Join Date
- Jan 2010
- Posts
- 7
- Rep Power
- 0
Thank you very much.
Then what should i do.
I am very blur.
Please guide me.
Thanks
- 01-19-2010, 11:34 AM #4
Similar Threads
-
cannot find symbol constructor
By daud in forum New To JavaReplies: 9Last Post: 08-13-2009, 03:53 AM -
cannot find symbol
By GabWit in forum New To JavaReplies: 3Last Post: 01-25-2009, 12:13 AM -
cannot find symbol symbol :constructor Error. Please help! =(
By KalEl in forum New To JavaReplies: 9Last Post: 10-18-2008, 08:26 PM -
cannot find symbol symbol : class Item location: package platypos.services.order
By officialhopsof in forum New To JavaReplies: 3Last Post: 05-01-2008, 08:30 AM -
Error: cannot find symbol
By silvia in forum New To JavaReplies: 1Last Post: 08-07-2007, 05:39 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks