Question

JAVA Assume that you are developing an Employee class with idNum, firstName, and lastName. – Now,...

JAVA

Assume that you are developing an Employee class with idNum, firstName, and lastName. – Now, you want to keep the Employee objects in an ArrayList. – Develop the correct equals() method of the Employee class.

Sample Run

1. Input a number: 100

2. Input a name: Tom

3. More items?(Y/N) y

4. Input a number: 200

5. Input a name: John

6. More items?(Y/N) n

7. The list contains:

8. 100 Tom

9. 200 John

10. Type the number and name to search

11. Number: 100

12. Name: Tom

13. 100 Tom is in the list

14. More search?(Y/N) n

15. Type the number and name to remove

16. Number: 100

17. Name: Tom

18. 100 Tom is removed from the list

19. The list contains:

20. 200 John

21. More remove?(Y/N) n

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
JAVA Assume that you are developing an Employee class with idNum, firstName, and lastName. – Now,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • In Java: Executable Class create an array of Employee objects. You can copy the array you...

    In Java: Executable Class create an array of Employee objects. You can copy the array you made for Chapter 20. create an ArrayList of Employee objects from that array. use an enhanced for loop to print all employees as shown in the sample output. create a TreeMap that uses Strings for keys and Employees as values. this TreeMap should map Employee ID numbers to their associated Employees. process the ArrayList to add elements to this map. print all employees in...

  • in Java Create a custom class Employee with field like name , empNo and salary. a....

    in Java Create a custom class Employee with field like name , empNo and salary. a. Create 5 objects b. Add all objects to ArrayList c. Print all employee details from ArrayList . d. Remove employee having salary less than 5000 $ [12] e. Insert a new employee object with more salary value at same index at which other object was removed. *

  • Create the Employee class: The Employee class has three attributes: private: string firstName; string lastName; string...

    Create the Employee class: The Employee class has three attributes: private: string firstName; string lastName; string SSN; The Employee class has ▪ a no-arg constructor (a no-arg contructor is a contructor with an empty parameter list): In this no-arg constructor, use “unknown” to initialize all private attributes. ▪ a constructor with parameters for each of the attributes ▪ getter and setter methods for each of the private attributes ▪ a method getFullName() that returns the last name, followed by a...

  • Using Java: Question 2 (30 pts). Suppose that a class, Employee, is defined as follows: class...

    Using Java: Question 2 (30 pts). Suppose that a class, Employee, is defined as follows: class Employeet String lastName; string firstName; double hourlywage; int yearsWithCompany; Suppose that a class, TestEmployee, has the data for 100 employees stored in an array: Employee[] employeeData Employee [ 100]; new Implement TestEmployee class that will output the first name, last name, and hourly wage of each employee who has been with the company for 20 years or more. Note: you can fill part of...

  • Part 1 Start by designing the Employee class Employee holds the following private attributes: a count...

    Part 1 Start by designing the Employee class Employee holds the following private attributes: a count of employees (a static variable called NUM_EMP)* an employee’s last name an employee’s first name an employeeNumber (a String that is unique – that will use the NUM_EMP)* a department a jobTitle an annual salary (e.g., 45000). NOTE: *NUM_EMP should start off as zero and get updated every time a new Employee is created. The employeeNumber always starts with empl_ followed by the current...

  • QUESTION B1. (7 marks) This question assumes the following relational schema Employee (employeeNumber, lastName, firstName, DOB,...

    QUESTION B1. (7 marks) This question assumes the following relational schema Employee (employeeNumber, lastName, firstName, DOB, HireDate, Position Salary, Dept) Primary Key: employeeNumber Foreign key: Dept refers to DeptID in Department Department (DeptID, DeptName, DeptLocation) Primary Key: DeptID You have been given the following MySQL stored procedure: CREATE PROCEDURE Find_EmployeeName (IN employeeNo INT (11), OUT employeeName VARCHAR (60)) BEGIN SELECT concat(firstName, '', lastName) INTO employeeName FROM employees WHERE employeeNumber employeeNo; END (a) (2 marks) Name the two types of parameters...

  • ----------------------------------- public class Customer { String firstName,lastName; //constructor public Customer(String firstName,String lastName) { this.firstName=firstName; this.lastName=lastName; }...

    ----------------------------------- public class Customer { String firstName,lastName; //constructor public Customer(String firstName,String lastName) { this.firstName=firstName; this.lastName=lastName; } //override toString() method public String toString() { return this.lastName+", "+this.firstName; } boolean equals(Customer obj) { if(this.firstName.equals(obj.firstName) && this.lastName.equals(obj.lastName)) return true; else return false; } } ----------------------------------- public class Ingredient { String ingredientName; int amount; double price; public Ingredient(String ingredientName,int amount,double price) { this.ingredientName=ingredientName; this.amount=amount; this.price=price; } double getCost() { return amount/1000.0*price; } public String toString() { return this.ingredientName+", "+this.amount+" mls, $"+this.price+"/L"; } } -----------------------------------...

  • Introduction In this lab, you will be working with three classes: Person, Student, and Roster. Person...

    Introduction In this lab, you will be working with three classes: Person, Student, and Roster. Person and Student represent individuals with a first and last name as String class variables, and Student has an additional int class variable that represents a ID number. The Roster class represents a group of people that are objects of either the Person or Student class. It contains an ArrayList. The Person class has been completed for you with class variables, a constructor, and a...

  • In Java programming language Please write code for the 6 methods below: Assume that Student class...

    In Java programming language Please write code for the 6 methods below: Assume that Student class has name, age, gpa, and major, constructor to initialize all data, method toString() to return string reresentation of student objects, getter methods to get age, major, and gpa, setter method to set age to given input, and method isHonors that returns boolean value true for honors students and false otherwise. 1) Write a method that accepts an array of student objects, and n, the...

  • Write a Java class named Employee to meet the requirements described in the UML Class Diagram...

    Write a Java class named Employee to meet the requirements described in the UML Class Diagram below: Note: Code added in the toString cell are not usually included in a regular UML class diagram. This was added so you can understand what I expect from you. If your code compiles cleanly, is defined correctly and functions exactly as required, the expected output of your program will solve the following problem: “An IT company with four departments and a staff strength...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT