Question: For Employee.java: 1 . Create the three attributes of the Employee class ( id , name, and salary ) as private fields as private fields.

For Employee.java:
1. Create the three attributes of the Employee class (id, name, and salary) as private fields as private
fields.
2.3. Create accessors and mutators for all three attributes.
Create a default constructor (no parameters!) for the Employee class that initializes the Employee
objects name field to TBD and salary field to 0.0. id should not be initialized (yet!)
4. Create an overloaded constructor for the Employee class accepts a String name and double salary as its
parameters and initializes your name and salary attributes to the values passed in. id should not be
initialized (yet!). Test that both of your constructors work before moving on.
5. Write a print method that prints an employee objects information as follows:
Employee ID: 5
Name: Alice
Salary: $50000.0
//Note the $, :, and spacing. Trailing decimals for salary is ok.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!