Question: Java Programming Question Create a class that represents an employee. This class will have three constructors to initialize variables. If the constructor doesn't provide a
Java Programming Question Create a class that represents an employee. This class will have three constructors to initialize variables. If the constructor doesn't provide a parameter for a field, make it either "(not set)" or "0" as appropriate. Given: public class EmployeeDemo { public static void printInfo(Employee e) { System.out.println(e.getName() + ", " + e.getIdNumber() + ", " + e.getDepartment() + ", " + e.getPosition()); } public static void main(String[] args) { Employee e1 = new Employee(); Employee e2 = new Employee("Bill Gates", 1975); Employee e3 = new Employee("Steve Jobs", 1976, "Design", "Engineer"); printInfo(e1); printInfo(e2); printInfo(e3); } }
Required output:
(not set), 0, (not set), (not set) Bill Gates, 1975, (not set), (not set) Steve Jobs, 1976, Design, Engineer
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
