Hi ... [ Need ur suggestion NOT code .... ]
This is one part of my assignment .. I need your help on how to do this . Below is my short description of my problem ...
I have two classes Named Passenger class and container class .
Passenger class has its own variables like passenger name ( String ) , ID ( int ), and Injury Level (An enum class which has priority like CRITICAL ,MODERATE,SLIGHT,NONE ).
Employee class has its own variable like containerID ( int ) , and ContainerType ( this can be one of the three types URGENT , IMPORTANT , or GENERAL - these are from enum class )
I will be taking this passenger details[ has 100 of passenger details ] and container details [ 100 of container ] from a file and write to a single Array . I used Object array Object[] array as advised in this form to store different objects [Passenger and Conatiner] . Now i want to sort this array based on criteria as mentioned below.
1. Sort People , most Highest priority first .
- This must sort the array in such a way that highest priority first ex:CRITICAL followed by MODERATE and so on ... Container are placed after sorted passengers.
2. Sort Containers ,most urgent first.
- This must sort the URGENT Container first followed by IMPORTANT and so on ... Any passenger are placed after the sorted container.
I have an interface function compareTo() in my Passenger and container class to implement . How do i sort so . Thanks.
Hi ... [ Need ur suggestion NOT code .... ]
This is one part of my assignment .. I need your help on how to do this . Below is my short description of my problem ...
I have two classes Named Passenger class and container class .
Passenger class has its own variables like passenger name ( String ) , ID ( int ), and Injury Level (An enum class which has priority like CRITICAL ,MODERATE,SLIGHT,NONE ).
Employee class has its own variable like containerID ( int ) , and ContainerType ( this can be one of the three types URGENT , IMPORTANT , or GENERAL - these are from enum class )
I will be taking this passenger details[ has 100 of passenger details ] and container details [ 100 of container ] from a file and write to a single Array . I used Object array Object[] array as advised in this form to store different objects [Passenger and Conatiner] . Now i want to sort this array based on criteria as mentioned below.
1. Sort People , most Highest priority first .
- This must sort the array in such a way that highest priority first ex:CRITICAL followed by MODERATE and so on ... Container are placed after sorted passengers.
2. Sort Containers ,most urgent first.
- This must sort the URGENT Container first followed by IMPORTANT and so on ... Any passenger are placed after the sorted container.
I have an interface function compareTo() in my Passenger and container class to implement . How do i sort so . Thanks.