Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Java class called Employee (Parts of the code is given below), which has three private fields firstName (String), lastName (String) and yearsEmployed (double).
Write a Java class called Employee (Parts of the code is given below), which has three private
fields firstName (String), lastName (String) and yearsEmployed (double). Implement
accessor/mutator methods for the private fields and toString() method, that returns a String
representation, which contains employee name and years she was employed.
public class Employee {
private String firstName;
...
}
Write a client program called EmployeeClient that creates an instance of Employee class, sets
values for the fields (name: John Doe, yearsEmployed: 4.5), and prints out the information about
an object.
Please note that you need to create 2 source files one for the class implementation
(Employee.java) and one for the client code (EmployeeClient.java).
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