2 of 3
Paper No: 1
Employee
Where:
id:int
name:String
salary:double
+Employee()
+Employee(id:int, name:String,
salary:double)
+getNameLength():int
+getNetSalary():double
+toString():String
Employee(): default constructor
Employee(id:int, name:String, salary:double) - parameterized constructor,which sets values to id, name, salary.
getNameLength():int-returns the number of characters present in the employee name.
getNetSalary():double return net salary with net salary=salary reduced by 10 percent
toString():String returns a string that contains all the information of the employee: id, name, salary. The salary is formatted by two decimal places.
Zoom
TLA
+ 90%
Close