First class name Item:
Data Fields are 2 only and remember these data fields should be private.
The public methods for this class will be the following:
A constructor the takes a String and a double as the input arguments to initialize the data fields.
Now on to the second class to be called CoffeeDriver which will contain the main method.
Methods required for the Driver class:
main - will create an array of Item Objects using the data above to set each itemís information. This information will NOT come from the user of the project. In addition, main should request from the user which order they wish to see the data items list, by price or by item name. Use a JOptionpane for this request. You might want to include a question to ask the user if they are finished with the program??
sortName this method will sort the array of item objects by the item name. Remember when creating your sort that when you are comparing String values you cannot use ==. You will want to use the compareTo() String method. See note below. You must also keep in mind that you will compare on the String of the item name only, but when you need to swap for the sort, you will be swapping a complete object which includes the name and price, not just the itemNames. This method will display the array of objects in item name order. The display will include both the itemName and the itemPrice.
sortPrice this method will sort the array of item objects by price. Again remember, when you need to swap the prices, you are swapping the entire object and not just the prices. Again this method will display the array of objects in price order. The display will include both the itemName and the itemPrice.