Question: A) Write a Java program: 1) Create a class called Employee that includes: three instance variables: first name (type String), the last name (type string),
A) Write a Java program:
1)
Create a class called Employee that includes:
three instance variables: first name (type String), the last name (type string), and a monthly salary (double).
constructor that initializes the three instance variables.
set and get methods for each instance variable. If the monthly salary is not positive, set it to 0.0.
a method that returns yearly salary (yearly salary = monthly salary *12)
a method called empDataToString() to return the information (first name, last name, monthly salary and yearly salary) of an Employee.
Write a test application named EmployeeTest that demonstrates class Employees capabilities. Create two Employee objects and display each objects information.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
