I need help properly implementing an array list and display error messages for incorrect input!!!
Design and implement Java program as follows:
There will be a Gift class with following attributes: order number (combination of letters and numbers), size (values S, M, or L), number of fruits, and price.]
There will be two child classes FruitBasket and SweetsBasket with the following additional attributes:
The Gift class hierarchy must provide the following functionality:
There is an ArrayList that holds all the orders generated. It is used to find the order number to change values and to display all entries.
The main () element includes the following functionality:
Your classes must be coded with correct encapsulation: private/protected attributes, and value validation.
FruitBasket: the fee for citrus fruits based on client preference.
SweetsBasket: the fee for bag of nuts based on client preference.
All attribute values can be changed after creation except order number and the values that are calculated or set by the system.
Order is entered by the user. The order either begins with FB or SB and then has three digits after those letters. Must check to be sure the order number is either letter code and only three digits.
When adding a new gift include in the prompt for the order number the pattern used for all orders.
Price is calculated as follows:There is a flat fee of 19.99 for Small gift, 29.99 for Medium gift, and 39.99 for Large gift.
Fruit basket gift has additional fee of 5.99 when it has citrus fruits.
Sweets basket gift has additional fee of 4.49 when it has nuts in it.
Number of fruits in a basket is as follows: Small size has 6 fruits, Medium has 9 fruits, and Large has 15 fruits.
In responding to basket having citrus or nuts there is the option of Yes/No or 1 for yes/2 for no.
Use the uppercase or lowercase function for the values entered. [So that the user can enter either upper or lower case for the size, reviewed the attached Use of Case Letters.docx document.]
Each class must have a method to return or display the class’s values to the console.
On creation [add to ArrayList], a gift order must be given all attribute values except price which must be calculated based on size and option for fruits or bag of nuts.
Instantiation of a Gift class.
Display a menu for selection.
Use a switch.
Order a gift.
The menu should contain:Add a Gift order. The user enters the order number. The order number is checked for letters and numbers. When order number, size, and options are entered, the correct order is added to the Gift array.
Change a gift [Find the appropriate id in the ArrayList and change the size and/or the added citrus or bag of nuts. Recalculate the price.]
Display a single gift order. [Display horizontally with order number, type of gift, size, cost, and specifics about the order. e.g., number of fruits or with citrus or nuts.]
Display all gift orders. [Display horizontally with order number, type of gift, size, cost, and specifics about the order. e.g., number of fruits or with citrus or nuts.]
Exit the program.
It should be considered as a driver, that is, only the minimum number of code lines are in it. Most of the coding is done in methods that are outside of the main () element. The switch should not be considered process coding – no conditionals or other detailed coding – but calls to methods in the program.
There should be appropriate overloading and overriding methods.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more