Question
1.) Create a new class called Course, with attributes such as FIUCourseName, credits, FloridaCourseName, arrayList of preRequisites, and yearLevel. The Course class must implement the
1.) Create a new class called Course, with attributes such as FIUCourseName, credits, FloridaCourseName, arrayList of preRequisites, and yearLevel. The Course class must implement the Comparable interface, using the compareTo() method to compare by FIUCourseName. The Course class' toString() method should include printing all the pre-requisites too, which are part of the course object. You will need 2 more comparator objects, to allow the comparison by FloridaCourseName, or by yearLevel.
2.) Create a new driver class whose main method will call at least 2 methods, one to create an arrayList of Course objects, and another to display a menu of options for the user.
The first method called from main will create an arrayList of Course objects by prompting the user to enter the core courses required for the IT major, and asking for all the information required to populate all the attributes of the Course object. Once done, the method will ask the user if he/she wants to enter another course. This will continue until the user replies that he/she is done entering the course information.
The second method called from main will continuously display a menu to the user, to select which the order in which to print the Course arrayList : by FIUCourseName by FloridaCourseName by yearLevel or exit the menu
Once a menu option is selected, the appropriate Collections.sort method will be called, and the arrayList will be printed in that order: a.) using either the Comparable interface to sort by FIUCourseName b.) using a Comparator object to sort by yearLevel c.) using a Comparator object to sort by FloridaCourseName.***
***Remember: Allow the user to sort in multiple ways without having to re-start the whole program, and re-enter all the data. (Hint: use a while loop)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started