JoAnn is starting her own business, a floral shop. She is getting ready for Mother’s day orders. She needs an application to keep track of all orders, calculate total cost of an order, print message cards to a file, and then sort the orders to be delivered by date and print to a file to be given to the driver.
There are three sizes of bouquets: small, medium and large. The base costs for the bouquets are as follows:
Small $19.00 Medium $35.00 Large $49.00
The delivery rates are based on the bouquet size as follows:
Bouquet Size: Small Medium Large Dates
Standard $7.00 $10.00 $15.00 May 8, 9 Holiday $10.00 $15.00 $20.00 May 10, 11 Before Noon – additional $5.00 $ 7.00 $10.00
Data Element – Order
Create a class called Order that implements the Comparable interface.
Include instance variables and a
method to calculate the total costs.
There should also be a toString method, getter and setters, and any other methods that are needed for your design.
The compareTo method will sort by the date of delivery and if it is a before noon delivery (before noon deliveries will come before those with same date and not before noon deliveries). Remember that your date is being stored as a string, so you’ve got to make sure “May 11” comes after “May 8”. Extract the numbers from the dates and compare.
Data Manager – OrderManager
Create an OrderManager class. It will implement the OrderManagerInterface.
It will contain an Arraylist which holds Comparable object references (since Order implements Comparable, it can hold references to Order objects). You will receive the following warning when creating this type of Arraylist: Comparable is a raw type. References to generic type Comparable should be parameterized. You can ignore these warnings for now.
There will be a method to addOrder (Submit order), printMessageCards, deliverySchedule and any other methods needed for your design.
deliverySchedule() will use the modified Sorting class to sort the deliveries by date, and if they are before noon. Return a string of all deliveries in the following format:
Delivery Schedule 2 blank lines < Date > *< To Street >, < To City > - < To Last Name >, < To First Name > (this is a before noon delivery) < To Street >, < To City > - < To Last Name >, < To First Name > (this is an after noon delivery) . . . 2 blank lines < Date > < To Street >, < To City > - < To Last Name >, < To First Name > . . .
printMessageCards() will return a string with all the message cards in the following format:
Dear Mom < Message > Love < FROM First Name >
Each message card will be separated by two blank lines. Use the modified Sorting class to sort by date and if before noon before printing.
Create the GUI. Make sure the total cost is in currency format. The delivery date must be correct for the type of delivery. Use an object of OrderManager to maintain the orders. The Clear button will clear the To and From fields as well as the Message and Total Cost fields. Use a JCheckBox for the Before Noon option. Use JRadioButtons to select Standard or Holiday options. Use a JComboBox to select the delivery dates. When the Standard button is selected, the JComboBox should only show May 8, May 9 and May10. When the Holiday button is selected, it should only show May 11 and May 12. You might want to look at the methods removeAllItems and insertItemsAt for the JComboBox to make this happen. Use the JFileChooser so that the user can select where the file for the message cards and the delivery schedule will be stored. Add Tool tips and Mnemonics to your buttons.
Utility Class – Sort
I have given you a Sort class which you will need to modify to work with an Arraylist< Comparable >. You will receive the following warning when creating this type of Arraylist: Comparable is a raw type. References to generic type Comparable should be parameterized. You can ignore these warnings for now. Sort the objects in the ArrayList by date, and if they are before noon. Deliveries before noon will have an * in front of them. Before noon deliveries appear before other deliveries on the same day.
It is not our intention to break the school's academic policy. Projects posted are only used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly fill out the form.
Please provide a valid email address and we'll get back to you in less than 24 hours.
We will be sending an invoice through PayPal upon confirmation.
We are a non profit organization however we need an amount to keep this organization running,
and to be able to complete our research and development.