Main Assignment
You are writing a simplified car dealership application. You are already provided with a large amount of code. Your job is to update the provided DealershipGUI class, as well as create the Truck class and the Sedan class. Pay particular attention to the Javadoc documentation for Truck class and Sedan class, as this documentation will provide method signatures for the methods you will need to include in those respective classes. The code is provided in a single zip file on Canvas. The Javadoc documentation is also in Canvas, but provided separately.
The relationships among classes :
- A Truck "is-a" Vehicle
- A Sedan "is-a" Vehicle
- A Truck "has-a" VehicleManufacturer
- A Sedan "has-a" VehicleManufacturer
- The GUI "has-a" ArrayList of Trucks, and an ArrayList of Sedans
Status of things:
The Vehicle class is complete. Look at all its variables, and remember that each is pertinent to any/all subclasses
The VehicleManufacturer enumerated type is sufficient
You need to write the Truck class in its totality. (HINT: this assignment is about inheritance - take advantage of the super class Vehicle). The unique characteristics of trucks (different from sedans!) include bed length (measured in feet, this is the length of the flat part of the truck used hauling) and payload (measured in pounds, this is maximum amount of weight a truck can carry)
You need to write the Sedan class in its totality. (HINT: this assignment is about inheritance - take advantage of the super class Vehicle). The unique characteristics of sedans (different from trucks!) include trunk size (measured in square feet, this is the size of trunk's storage space)
The DealershipGUI class needs the following:
- A jTabbedPane component, with three tabs. This has already been set up for you. But do explore it. Try adding (and then deleting) additional jPanels so that you are comfortable with how this component works.
- A "Load Data" jPanel (aka tab) that handles reading the input text file. This has already been set up for you. This tab utilizes a FileChooser Swing component for choosing the input file. If you wish, try adding (and then deleting) a jPanel to create a new tab, and drag a FileChooser component into it as a test.
- jFileChooser Action method that reads the selected file and loads it data into appropriate data structures. This method and code has already been provided to you.
- A "Truck" tab that allows choosing an individual truck from a list, viewing its data and UPDATING ITS SALE PRICE if needed, and providing different sorted views of the truck inventory. You must write all the code for implementing this tab, including
- The method that reacts to a truck combo box choice, and populates all individual fields on the "Truck" tab based on the choice
- The method that reacts to an update of a truck's sale price, and saves it
- The method that reacts to a sort combo box choice, and sorts and displays trucks in that order
- A "Sedan" tab that allows choosing an individual sedan from a list, viewing its data and UPDATING ITS SALE PRICE if needed, and providing different sorted views of the sedan inventory. You must write all the code for implementing this tab, including
- The method that reacts to a sedan combo box choice, and populates all individual fields on the "Sedan" tab based on the choice
- The method that reacts to an update of a sedan's sale price, and saves it
- The method that reacts to a sort combo box choice, and sorts and displays sedans in that order
- Exit button code.
The comma separated value (csv) input file, named Assignment11VehicleData.txt, is located in the project Source Packages folder, in the dealership sub folder alongside all the source code provided. Below is the ordering of the fields in the file, each field's data type, and a sample sedan record and a sample truck record. see image.
See the sample interface screenshots below. Execution should start with the "Data Load" tab where the user chooses the file. Hitting the open button will execute the code that opens the file, reads it, loads the sedans and trucks lists, and populates combo box drop downs needed for Trucks and Sedans tab. You should then be able to choose either tab - they both work the same way. They each allow you to Select Vehicle from combo box, which should populate the screen with all the detailed data for the selection. You can modify the Sale Price field, but beware that input must consist of only digits and a decimal point if need. Exclude dollar signs and commas, lest you will get an error. Be sure to understand where that error is coming from in the code provided! Each tab also provides a combo box of sort criteria, which when selected should sort the lists of either trucks or sedans (depending on the tab) and display the sorted list in the text area with scrolling. An important point to consider when sorting if you sort the original list then the indexing on the Select Vehicle combo box will no longer match the ordering of the list. (Hint think about sorting a copy of the list. Either make a copy manually by looping through the list yourself, or consider the addAll method that ArrayList offers.
Background Knowledge:
- Vehicle Identification Numbers (VINs) are mix of digits and uppercase characters, each 17 long. They are unique to the vehicle.
- Most vehicles will not have a Sale Price, because they have not yet been sold. Those handful with a sale price means they have already been sold.
User Interface:
- Sample screen shots are provided below.
- Be sure to put your name on the GUI form as a label (in place of "Joe Waldron") This will assist during grading.
- Only the Sale Price field should be editable. All others cannot be changed through the interface.
- Detailed fields should be formatted appropriately - currency (like sticker price) should be displayed in a currency format.
- It may be prudent to set the font for the text area box displaying the sorted data to Courier, since this is a monospaced font and will be easier to read. (If you really want the output to be legible, you would not only set the font to Courier, but also format each variable to the same display length, which would display the data in columnar format, with all the same data elements lining up perfectly underneath each other.)
Task Details:
- Documentation is provided as Javadoc documents. Be absolutely certain for the class that you write that you create comments in Javadoc format, including comments for all parameters and method return values. I will be generating Javadoc from your submission. If information is missing, or doesn't generate properly, you will lose points. So be sure to generate to generate the Javadoc for Sedan and Truck class yourself, and check that it is comprehensive!
- Make use of inheritance! Don't try to re-write code that can be inherited or which can be run via super.
- If the user enters letters into the sale price text box - you should "catch" the exception and produce an error message, allowing you to correct, assuming you have called the appropriate set method. Check out how this is done by looking at previous try and catch examples we've gone through.
- Take the expedient path of including all classes including the GUI class and enumerated types in the same project and package. This is also where input text file should be as well.
On Start Up: see image.
After choosing the file and hitting "Open" button see image.
Look at Output window for message informing all records in input file have been processed see image.
Select the Trucks tab see image.