For the question below please program all of this in java please and thank you.
Below here Wil be the code for the sorter program and will be the java html file of what the train program is suppose to do. Please and thank you for taking the time to build the train program base on the information given in the html train pdf file thanks.
Sorter file.
/** Sorter class provides methods for sorting lists. Adapted from Java Software Solutions 9th Ed, Lewis & Loftus */
public class Sorter>{ /** Sorts the specified array using selection sort algorithm. @param list The array of objects to sort. */ public void selectionSort(T[] list){ int min; T temp; for(int index = 0; index Below here is the test case 1 which was used to give the example output.
CN Railway 5 P714 2012 85 true F019 2018 75000 F221 2016 105000 T102 2017 35000 true P904 2018 78 false T102 F220 P714
Here is the train html file thanks please program in java.
Here is the other part of the assigment which will use the trainCar java file to build test cases and other things please program in java
That is the test case output above please program to make all of it look like that in java. Thanks
Part 1 You will design and implement a hierarchy of categories of train cars that can be coupled together to form a train. The train cars that can be part of the train include passenger cars, freight cars, and tank cars. The train car code, which consists of letters and numbers, and the year the train car was last inspected are recorded for each train car in the train. The train car code starts with P for passenger cars, F for freight cars, and I for tank cars. For passenger cars, the number of tickets sold for the car and if the car has food service (true) or not (false) is recorded. The income a passenger car generates is based on a ticket price of $120 if there is no food service on the car and $150 if there is. For freight cars, the weight of the freight it is hauling is recorded and the income the car generates is based on a hauling fee of $11,500 for loads of under 100,000lbs and $25,000 for loads of 100,000lbs or more. For tank cars, the volume of materials the tank contains in litres and if the materials are hazardous (true) or not (false) are both recorded. The income a tank car can generate is based on a hauling rate of $17/L for hazardous materials and $9.50/L for all other materials. Include a TrainCar class in your design. The TrainCar class must comply with the Javadoc specifications given in TrainCar.pdf (posted in D2L). PACKAGE CLASS TREE DEPRECATED INDEX HELP PREV CLASS NEXT CLASS FRAMES NO FRAMES ALL CLASSES SUMMARY: NESTED FIELD CONSTR | METHOD DETAIL: FIELD CONSTR | METHOD Class Train Car java.lang. Object Train Car All Implemented Interfaces: java.lang.Comparable Traincar> public abstract class Traincar extends java.lang.Object implements java.lang.Comparable This class represents a train car. Field Summary Fields Modifier and Type Field and Description private java.lang.String code The train car's code. private int inspectioner The train car's year of last inspection. Constructor Summary Constructors Constructor and Description TrainCar(java.lang. String code, int inspectionYr) Constructs a train car with a specific code and inspection year. Method Summary All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract double calculateIncome ( ) Calculates the income of the train car. int compareTo(TrainCar other) Sorts train car alphabetically by type in alphabetical order F, P, T, and each type is then sorted by the calculated income in ascending order (lowest to highest income). java.lang.String getCode() Returns the train car's code. int getInspectionYr() Returns the inspection year of the train car. java.lang.String toString() Returns a formatted textual string containing information about the train car including code, inspection year, and calculated income. Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait Field Detail code private java.lang.String code The train car's code. inspection Yr private int inspectioner The train car's year of last inspection. Constructor Detail TrainCar public TrainCar(java.lang. String code, int inspection Yr) Constructs a train car with a specific code and inspection year. Parameters: code - the code of the train car. inspectionYr - the inspection year of the train car. Method Detail getCode public java.lang.String getCode) Returns the train car's code. Returns: returns the train car's code. getInspection Yr public int get InspectionYr() Returns the inspection year of the train car. Returns: returns the inspection year of the train car. compare To public int compareTo(Traincar other) Sorts train car alphabetically by type in alphabetical order F, P, T, and each type is then sorted by the calculated income in ascending order (lowest to highest income). Specified by: compareto in interface java.lang.Comparable Parameters: other - the train car being compared to this train car. Returns: the result of the comparison. calculateIncome public abstract double calculateIncome) Calculates the income of the train car. Returns: the calcuated income of the train car. toString public java.lang.String toString() Returns a formatted textual string containing information about the train car including code, inspection year, and calculated income. Overrides: toString in class java.lang.Object Returns: textual string containing the code, inspection year, and income of the train car. PACKAGE CLASS TREE DEPRECATED INDEX HELP PREV CLASS NEXT CLASS FRAMES NO FRAMES ALL CLASSES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD Your design must follow oo design principles illustrated in Chapter 10. Construct a UML class diagram. There are several examples of UML class diagrams in your textbook (ie: Figure 10.1). In your diagram there should be a box for each class (divided into 3 sections: name, attributes, methods) and appropriate connecting lines to indicate relationships between classes. All instance variables and methods should be shown including private data/methods and constructors. Remember, private items have a minus sign in front of them, public items have a plus sign in front of them, and abstract class and method names are italicized. You can make your UML diagrams using a drawing application, or if you prefer you can instead draw it by hand on paper and take a photo to include in your report document. However, please make sure that your diagram is neat and easy to read when you take a photo of it. Pencil probably won't show up that well, so you may need to make a good copy using pen. Part 2 Design a Train class for keeping track of the company that owns the train and the train cars that make up the train. You must use arrays and not ArrayList to store the train cars in the Train class. The following operations must be supported by separate methods in the Train class: 1. Returns a copy of the list of train cars in the train (note: this will be the train car array you will sort in the driver). 2. Search for a given train car using the train car code passed in as a parameter. This method returns the target train car if found, null otherwise. 3. toString() that returns all the information about the train including the list of train cars and the income of each car (see example in the sample output) Add the Train class to your UML diagram and include the appropriate connections. Part 3 Implement the classes described in Parts 1 and 2. . For testing these classes, create a driver program that creates a Train object representing a train owned by some company that has some train cars that form the train of each type (passenger, freight, tank). The name of the company and the list of train cars are passed in as parameters to the constructor. Print the Train object (using the toString() method); this will print the name of the company and the list of train cars in the original order (with the code, year of last inspection, and calculated income). See sample output provided at the end of the assignment document. Then, print the list of vehicles in sorted order (train cars are sorted alphabetically by type F, P, T and if they have the same type then sorted by income in ascending order (smallest income to greatest income)) using the selectionSort method provided in the Sorter class. Remember to sort a copy of the train car list. Include in the printout only the code and the income of the train. See sample output provided at the end of the assignment document. Then, search for a few specific vehicles' codes among the vehicles in the inventory; print an appropriate message for these searches. See sample output provided at the end of the assignment document. Part 4 Test your program with the test file (test 1.txt) that is posted in D2L and shown on the next page. Also, create two additional test files of your own. Each test file will have the same structure and contents of the test file provided: train company's name (on a separate line), number of train cars (on a separate line), followed by lines with the code and inspection year, and then the information specific to each train car type. Include at the end some codes that you will search the inventory for. Note the code for passenger cars starts with 'P', the code for freight cars starts with 'F' and the code for tank cars starts with 'T'. Sample Input: CN Railway 5 P714 2012 85 true F019 2018 75000 F221 2016 105000 T102 2017 35000 true P904 2018 78 false T102 F220 P714 Sample Output: CN Railway P714 Inspection Year: 2012 Income: $12,750.00 F019 Inspection Year: 2018 Income: $11,500.00 F221 Inspection Year: 2016 Income: $25,000.00 T102 Inspection Year: 2017 Income: $595,000.00 P904 Inspection Year: 2018 Income: $9,360.00 Sorted Data: F019 F221 P 904 P714 T102 $11,500.00 $25,000.00 $9,360.00 $12,750.00 $595,000.00 Search results: Train Car T102 Train Car F220 Train Car P714 found NOT found found Part 1 You will design and implement a hierarchy of categories of train cars that can be coupled together to form a train. The train cars that can be part of the train include passenger cars, freight cars, and tank cars. The train car code, which consists of letters and numbers, and the year the train car was last inspected are recorded for each train car in the train. The train car code starts with P for passenger cars, F for freight cars, and I for tank cars. For passenger cars, the number of tickets sold for the car and if the car has food service (true) or not (false) is recorded. The income a passenger car generates is based on a ticket price of $120 if there is no food service on the car and $150 if there is. For freight cars, the weight of the freight it is hauling is recorded and the income the car generates is based on a hauling fee of $11,500 for loads of under 100,000lbs and $25,000 for loads of 100,000lbs or more. For tank cars, the volume of materials the tank contains in litres and if the materials are hazardous (true) or not (false) are both recorded. The income a tank car can generate is based on a hauling rate of $17/L for hazardous materials and $9.50/L for all other materials. Include a TrainCar class in your design. The TrainCar class must comply with the Javadoc specifications given in TrainCar.pdf (posted in D2L). PACKAGE CLASS TREE DEPRECATED INDEX HELP PREV CLASS NEXT CLASS FRAMES NO FRAMES ALL CLASSES SUMMARY: NESTED FIELD CONSTR | METHOD DETAIL: FIELD CONSTR | METHOD Class Train Car java.lang. Object Train Car All Implemented Interfaces: java.lang.Comparable Traincar> public abstract class Traincar extends java.lang.Object implements java.lang.Comparable This class represents a train car. Field Summary Fields Modifier and Type Field and Description private java.lang.String code The train car's code. private int inspectioner The train car's year of last inspection. Constructor Summary Constructors Constructor and Description TrainCar(java.lang. String code, int inspectionYr) Constructs a train car with a specific code and inspection year. Method Summary All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract double calculateIncome ( ) Calculates the income of the train car. int compareTo(TrainCar other) Sorts train car alphabetically by type in alphabetical order F, P, T, and each type is then sorted by the calculated income in ascending order (lowest to highest income). java.lang.String getCode() Returns the train car's code. int getInspectionYr() Returns the inspection year of the train car. java.lang.String toString() Returns a formatted textual string containing information about the train car including code, inspection year, and calculated income. Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait Field Detail code private java.lang.String code The train car's code. inspection Yr private int inspectioner The train car's year of last inspection. Constructor Detail TrainCar public TrainCar(java.lang. String code, int inspection Yr) Constructs a train car with a specific code and inspection year. Parameters: code - the code of the train car. inspectionYr - the inspection year of the train car. Method Detail getCode public java.lang.String getCode) Returns the train car's code. Returns: returns the train car's code. getInspection Yr public int get InspectionYr() Returns the inspection year of the train car. Returns: returns the inspection year of the train car. compare To public int compareTo(Traincar other) Sorts train car alphabetically by type in alphabetical order F, P, T, and each type is then sorted by the calculated income in ascending order (lowest to highest income). Specified by: compareto in interface java.lang.Comparable Parameters: other - the train car being compared to this train car. Returns: the result of the comparison. calculateIncome public abstract double calculateIncome) Calculates the income of the train car. Returns: the calcuated income of the train car. toString public java.lang.String toString() Returns a formatted textual string containing information about the train car including code, inspection year, and calculated income. Overrides: toString in class java.lang.Object Returns: textual string containing the code, inspection year, and income of the train car. PACKAGE CLASS TREE DEPRECATED INDEX HELP PREV CLASS NEXT CLASS FRAMES NO FRAMES ALL CLASSES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD Your design must follow oo design principles illustrated in Chapter 10. Construct a UML class diagram. There are several examples of UML class diagrams in your textbook (ie: Figure 10.1). In your diagram there should be a box for each class (divided into 3 sections: name, attributes, methods) and appropriate connecting lines to indicate relationships between classes. All instance variables and methods should be shown including private data/methods and constructors. Remember, private items have a minus sign in front of them, public items have a plus sign in front of them, and abstract class and method names are italicized. You can make your UML diagrams using a drawing application, or if you prefer you can instead draw it by hand on paper and take a photo to include in your report document. However, please make sure that your diagram is neat and easy to read when you take a photo of it. Pencil probably won't show up that well, so you may need to make a good copy using pen. Part 2 Design a Train class for keeping track of the company that owns the train and the train cars that make up the train. You must use arrays and not ArrayList to store the train cars in the Train class. The following operations must be supported by separate methods in the Train class: 1. Returns a copy of the list of train cars in the train (note: this will be the train car array you will sort in the driver). 2. Search for a given train car using the train car code passed in as a parameter. This method returns the target train car if found, null otherwise. 3. toString() that returns all the information about the train including the list of train cars and the income of each car (see example in the sample output) Add the Train class to your UML diagram and include the appropriate connections. Part 3 Implement the classes described in Parts 1 and 2. . For testing these classes, create a driver program that creates a Train object representing a train owned by some company that has some train cars that form the train of each type (passenger, freight, tank). The name of the company and the list of train cars are passed in as parameters to the constructor. Print the Train object (using the toString() method); this will print the name of the company and the list of train cars in the original order (with the code, year of last inspection, and calculated income). See sample output provided at the end of the assignment document. Then, print the list of vehicles in sorted order (train cars are sorted alphabetically by type F, P, T and if they have the same type then sorted by income in ascending order (smallest income to greatest income)) using the selectionSort method provided in the Sorter class. Remember to sort a copy of the train car list. Include in the printout only the code and the income of the train. See sample output provided at the end of the assignment document. Then, search for a few specific vehicles' codes among the vehicles in the inventory; print an appropriate message for these searches. See sample output provided at the end of the assignment document. Part 4 Test your program with the test file (test 1.txt) that is posted in D2L and shown on the next page. Also, create two additional test files of your own. Each test file will have the same structure and contents of the test file provided: train company's name (on a separate line), number of train cars (on a separate line), followed by lines with the code and inspection year, and then the information specific to each train car type. Include at the end some codes that you will search the inventory for. Note the code for passenger cars starts with 'P', the code for freight cars starts with 'F' and the code for tank cars starts with 'T'. Sample Input: CN Railway 5 P714 2012 85 true F019 2018 75000 F221 2016 105000 T102 2017 35000 true P904 2018 78 false T102 F220 P714 Sample Output: CN Railway P714 Inspection Year: 2012 Income: $12,750.00 F019 Inspection Year: 2018 Income: $11,500.00 F221 Inspection Year: 2016 Income: $25,000.00 T102 Inspection Year: 2017 Income: $595,000.00 P904 Inspection Year: 2018 Income: $9,360.00 Sorted Data: F019 F221 P 904 P714 T102 $11,500.00 $25,000.00 $9,360.00 $12,750.00 $595,000.00 Search results: Train Car T102 Train Car F220 Train Car P714 found NOT found found