Question
Write a class encapsulating the concept of an Employee, assuming that an employee has the following attributes: last name, first name, empId and salary. Make
Write a class encapsulating the concept of an Employee, assuming that an employee has the following attributes: last name, first name, empId and salary. Make sure that salary is greater than zero. Include two overloaded constructors to set all the four values, the accessors and mutators, and method toString. Also code the following method returning the salary and empId. Write a client class to test all your methods. Create 5 Employees two with the two overloaded constructors with all four parameters and the other three employees by invoking the default constructor. Store all these 5 objects in an array and display the employees information with foreach loop
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