Question
***Please check sample run before answering Thank You*** Create a class called Employeeapp in netbeans that includes four pieces of information as instance variables (declared
***Please check sample run before answering Thank You***
Create a class called Employeeapp in netbeans that includes four pieces of information as instance variables (declared as private):
a first name (type String), firstName
a last name (typeString), lastName
a employee ID (type integer), employeeId
a salary (type double), salary
Your class should have three different constructors that initializes the four instance variables.
A default constructor will have no parameters; a constructor that includes the first and last names as parameters and a constructor that includes all instance variables as parameters:
public Employee()
public Employee( String last, String first )
public Employee( String last, String first, int id, double wage )
Create a set and a get method for each of the four instance variables.
If the monthly salary is not positive, set it to 0.0.
Create a toString method() which provides a formatted output in a String return value, to be used when the application prints the object.
Create a equals method() to compare a String parameter with the String that is stored in the lastName instance parameter.
Add three Constructors to the Employee class to properly create an object. These default constructor will contain no parameters and will initialize the four instances variables. The second constructor will include the first and last names as parameters, which will set the instance variables, initialize the other two.
The third constructor will include all four parameters, which will set the instance variables.
Add four set (mutator) methods and four get (accessor) methods, for each of the four instance variables. The mutator and accessor method should be named appropriately to match the variables: i.e., setFirstName and getFirstName.
These methods should be defined as public, so they are accessible by the application.
The application shell has been created, which is a simple menu program.
Enter Selection
===============
A> Add new Employee
E> Edit Employee
L> List Employees
Q> Quit
If the user selects Add, the application must be modified to prompt the user for appropriate employee information and set the specific information using the mutator methods you created in
Run the EmployeeApp, choose . The object references are displayed on the screen.
Add a toString method to the Employee class which returns a formatted string pertaining to the employee information. Play with returning different formatted strings, this choose when running the application. This will demonstrate how this method controls the format of the employee object. String toString()
If you choose Edit from the EmployeeApp, the application will prompt for a last name. The application will do a comparison of this last name to each employee object. Add a equals method to the Employee class which accepts the last name String that was entered from the menu and return either true or false. This method will compare the object last name variable (this.lastName) with the last name that was prompted for in the application. If the names match, return true. If the names do not match, return false.
public Boolean equals( String name )
Sample Output
Enter Selection
===============
A> Add new Employee
E> Edit Employee
L> List Employees
Q> Quit
Select: l
Mitchum, Robert
ID Number: 120402
Salary : $34000.00
Ryan,
Cornelius
ID Number: 0
Salary : $0.00
Asimov, Isaac
ID Number: 0
Salary : $0.00
null
null
Enter Selection
===============
A> Add new Employee
E> Edit Employee
L> List Employees
Q> Quit
Select: a
Enter Last Name : Frost
Enter
First Name : Jack
Enter Employee ID : 93842
Enter Employee Salary: 34500
Enter Selection
===============
A> Add new Employee
E> Edit Employee
L> List Employees
Q> Quit
Select: l
Mitchum, Robert
ID Number: 120402
Salary : $34000.00
Ryan, Cornelius
ID Number: 0
Salary : $0.00
Asimov, Isaac
ID Number: 0
Salary : $0.00
Frost, Jack
ID Number: 93842
Salary : $34500.00
null
Enter Selection
===============
A> Add new Employee
E> Edit Employee
L> List Employees
Q> Quit
Select: e
Enter Last Name of Employee to Edit: Ryan
Enter Employee ID : 982734
Enter Employee Salary: 76250
Enter Selection
===============
A> Add new Employee
E> Edit Employee
L> List Employees
Q> Quit
Select: l
Mitchum, Robert
ID Number: 120402
Salary : $34000.00
Ryan, Cornelius
ID Number: 982734
Salary : $76250.00
Asimov, Isaac
ID Number: 0
Salary : $0.00
Frost, Jack
ID Number: 93842
Salary : $34500.00
null
Enter
Selection
===============
A> Add new Employee
E> Edit Employee
L> List Employees
Q> Quit
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