Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Start a new project in NetBeans named project-5 that defines a class Person with the following: Instance variables firstName (type String), middleInitial (type char) and

  • Start a new project in NetBeans named "project-5" that defines a class Person with the following:
    • Instance variables firstName (type String), middleInitial (type char) and lastName (type String)
    • (1) A no-parameter constructor with a call to the this constructor; and (2) a constructor with String, char, String parameters (assign the parameters directly to the instance variables in this constructor--see info regarding the elimination of set methods below)
    • Accessor (get) methods for all three instance variables (no set methods are required which makes objects instantiated from this class immutable since they subsequently cannot be updated)
    • A toString() method that returns a String representation of an object in the form: John H. Johnson
      • (1) Instantiate a comparator class PersonComparator that implements the Comparator interface; (2) in the compare() method of this comparator class, sort "Person" objects by last name and then first name and then middle initial; (3) instantiate and use a new "PersonComparator" object within a Collections.sort() to sort the List; and (4) iterate through and display the toString() methods of each element of the sorted List using an Iterator object
  • This project may be completed as either a Java console or JavaFX application

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

=+1. Who will receive the final evaluation?

Answered: 1 week ago