Hw 2 :Collections

    Using Collection

  • Create a product class
  • Define two properties name and weight with proper data type access modifier
  • Create a constructor class and initialize the properties
  • Define two methods getName and getWeight that will return name and weight respectively
  • override toString method to return t the product name and weight
  • On the Main class
  • Create 4 instances(objects) of the product class. Pass all the necessary values
  • Create an ArrayList collections
  • Add the 4 objects inside the ArrayList collections
  • Use for loop to print the ArrayList Collection
  • Using the collection remove method remove a single object from your collection
  • Using for loop print the ArrayList
  • Call a method to check whether the removed object exist or not
  • Call a getName and getWeight method from your product class and print the result
  • SAMPLE OUTPUT

How to submit Homework?

  • Add your full name and email at the top of the file using a comment tag.
  • Compile and run your program, entering the required inputs.
  • Take a screenshot of the result.
  • Zip your project with the source code, then upload it on Blackboard.
  • Upload screenshot on Blackboard.
  • Note: Submit the assignment on Blackboard by the due date. Email and late submissions will not be accepted.

    Due Date :06/25/2023 11:59 PM Sunday