Java Class Employee Attributes Private Id String Lastname String Firstname String Salary I Q37140987

In Java

Class Employee

Attributes (all private):

  • id: String
  • lastName: String
  • firstName: String
  • salary: int

Methods:

  • Parameterized constructor for initializing a new Employeeinstance
  • Getters for all attributes
  • toString method to display an Employee’s attributes (See outputof executable below)

Executable Class

  • Create an array of at least eight Employeeobjects.
  • Be sure to use many with identical last names, butdon’t order them by name in the array.
  • Create an ArrayList from the array.
  • Sort the ArrayList first by last name and then by firstname.
  • Using the forEach method and a lambdaexpression, print all employees alphabetically sorted byname.
  • Create a LinkedList from the ArrayList.
  • Create an iterator capable of cycling bothforward and backward through the LinkedList.
  • Iterate forward through the LinkedList withoutgenerating
    OR
    OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.