Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started