This Question is related to Java Language Implement a class
This Question is related to Java Language
Implement a class Employee. An employee has a name (string) and a salary (double). Write a default constructor. Write a constructor with two parameters (name and salary). Write methods to return the name and salary.Solution
import java.io.*;
public class Employee {
String name;
double salary;
public Employee() {
this.name =null;
this.salary=0.0;
}
public Employee(String name Double salary) {
this.name = name;
this.salary=salary;
}
public String getName() {
return name;
}
public Double getSalary() {
return salary;
}
}
