In this assignment youll create an JavaFx application that allows the user to enter and sort a student database. Youll be creating a JavaFx GUI, and get some experience using abstract classes and interfaces.

Student Class

Implement a class called Student to store student information. Your class should be based on the abstract class Person provided with this assignment. In addition to the inherited fields and methods, include the following fields/methods:

  • A field to store the students GPA
  • An implementation for the abstract method currentStatus. This could simply return the string Student.
  • A toString method that includes the GPA and follows the format of Person.toString. Hint: You could call the superclass to do most of the work.
  • Any required getters or setters

Youll be using your Student class in a list of students created by your GUI.

JavaFx GUI

Create an JavaFx application which allows you to enter student information. Your GUI should have one activity with the following components:

  • Text fields to enter the students name, address, and GPA
  • Buttons (Button) to add a new student, sort the list of students, and display the list of students.
  • Any required labels or other items to make your GUI look good and be easy to use.

The following image shows a possible GUI design, but this is just a fairly boring example, design your GUI in the way you think is best. see image.

You should use an ArrayList of Student objects to store your list of students. The Add button adds a new student to the end of the list, the sort button sorts your list of students by name, and the display button shows a simple popup dialog containing a list of all students information (student info provided by the toString method).

Popup Dialog

Create a second scene and set the modality as follows:

...
Stage secondStage = new Stage();
secondStage.initModality(Modality.APPLICATION_MODAL);
secondStage.setScene(scene);
...

Sorting Your ArrayList

To sort your list of students you can use the Collections.sort method from the Java library. For this to work you must implement the Comparable interface for the objects being sorted. A good place to put the Comparable interface implementation is in the Person class, since we are sorting by name (a field of the Person class). Update the class I provided.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.