Hw5:Sorting

    Create a program that generates your friend contact list

  • Define a class name Contact with implements Comparable interface
  • Define three properties firstName,lastName,phone as assign proper data type
  • Define a construct and initialize all three properties
  • Create a toString override method that will return lastname + firstname + phone
  • Create two getter methods (getFirstName and getLastName)
  • Override the compareTo(object obj) method and implement the logic to compare firstname and lastName
  • Create a selectionSort method takes (Comparable[])as an arguments and sort the list of Contact object
  • On Main
  • Create a Contact array object for eg Contact[] friend= new Contact[5]
  • Create 5 contacts array with firstname, lastname and phonenumber
  • Call the SelectionSort method and pass the list of contact as a parameter
  • Loop through the contact and print the result.
  • SAMPLE OUTPUT

Due Date :07/07/2023 11:59 PM Friday

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.