The assigment also requires an inventory class that is instantiated in the main ()
Gift Hierarchy Before attempting this project, be sure you have completed all the reading assignments, non-graded exercises, discussions, and assignments to date. There is only one java file for all the coding of this assignment allowed. Multiple java files are not acceptable. Design and implement Java program as follows: 1) There will be a Gift class with following attributes: order number (combination of letters [2] and numbers[3]), size (values S for Small, M for Medium, or L for Large), number of fruits, and price.] 2) There will be two child classes FruitBasket and Sweets Basket with the following additional attributes: - FruitBasket: the fee for adding citrus fruits based on client preference. - SweetsBasket: the fee for additional bag of nuts based on client preference. 3) The Gift class hierarchy must provide the following functionality: - All attribute values can be changed after creation except order number and the values that are calculated or set by the system. - An order id is entered by the user. The order either begins with FB or SB and then has three number characters after those letters. Must check to be sure the order id is either letter code [FB or SB] and only three number characters. - When adding a new gift include prompts for the size and adding preference or not to the order id with citrus for FB and nuts for SB. - Price is calculated as followst. 0. There is a flat fee of 19.99 for Small gift, 29.99 for Medium gif, 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 citnis or nuts there is the option of Yes/No or 1 for yes/2 for no. - Use the upperease or lowerease 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 docr document.] - Each class must have a method to retum or display the class's values to the console. 4) There is an ArmayList that holds all the orders generated. It is used to find the order id to change size or preference of an order. CMLs242: Assimenent 2 5) The main 0 element includes the following functionality: - On creation [add to ArrayList], a gift order must be given all attribute values except price which must be calculated based on size and preference option for citrus 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 id. The order id is checked for letters and numbers. When order number, size, and preference options are entered, the correct order is added to the Gift array with the price. - 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 additional citnus fruit 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 additional citrus fruit 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 0 element. The switch should not be considered process coding - no conditionals or other detailed coding - but calls to methods in the program. 6) Your classes must be coded with correct encapsulation: private/protected attributes, and value validation. 7) There should be appropriate overioading and overriding methods. Style and Documentation: Make sure your Java program is using the recommended style such as: - Javadoc comment up front with your name as author, date, and brief purpose of the program. - Comments for variables and blocks of code to describe major functionality \{refer to the Documentation of Programs found in Week 1). - Meaningful variable names and prompts - no single character that is meaningless. - Class names are written in upper CamelCase - Constants are written in All Capitals - Use proper spacing and empty lines to make code more user-friendly. readable. Mew 1: Order a 61ft lasket 2: Change 61ft lasket 3: Display 6Ift lasket 4: BIsplay all Gift 3askets 5: Exit pegran Enter youn selectlon: 3. No tlift has been erdered yet MENU 1. Orser a 6ift lusket 2: Changt 6ift lasket 3: Dlspluy 6 :ft Basket 4. Display al1 6ift baskets 9: Exit progran Fater your selection: 9 Thank you for usine the proerat. Goodbye! Sample run 2: neku 1) Ordee a Gift Basket 2. Chance 61+t asket 3: Dlsplay Gift Hasket. 4. Display all 6ift iapkets 9i Enit prograt Eater yaur selectlos: 2 Ae slft has been ordered yet Sample run 3: REau 1: Order a Gift lasket 2. Chasce bift basket 3. Display Gift sasket 4. o1splay all oift saicets 5: Exit arogran Enter your teitction: 1 CMigr-42: Awenmem 2 Deplic 2023 Ge jas ant truit sunet (1) er Suents Bantet (2): 3 But alie de row watnis, k, er it s bo pee want citres traisi decluied? : for yes/2 for ser 1 There is only one java file for all the coding of this assignment allowed. Multiple java files are not acceptable. Design and implement Java program as follows: 1) There will be a Gift class with following attributes: order number (combination of letters[2] and numbers[3]), size (values S for Small, M for Medium, or L for Large), number of fruits, and price.] 2) There will be two child classes FruitBasket and Sweets Basket with the following additional attributes: - FruitBasket: the fee for adding citrus fruits based on client preference. - SweetsBasket: the fee for additional bag of nuts based on client preference. 3) The Gift class hierarchy must provide the following functionality: - All attribute values can be changed after creation except order number and the values that are calculated or set by the system. - An order id is entered by the user. The order either begins with FB or SB and then has three number characters after those letters. Must check to be sure the order id is either letter code [FB or SB] and only three number characters. - When adding a new gift include prompts for the size and adding preference or not to the order id with citrus for FB and nuts for SB. - 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. 4) There is an ArrayList that holds all the orders generated. It is used to find the order id to change size or preference of an order. 5) The main () element includes the following functionality: - On creation [add to ArrayList], a gift order must be given all attribute values except price which must be calculated based on size and preference option for citrus 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 id. The order id is checked for letters and numbers. When order number, size, and preference options are entered, the correct order is added to the Gift array with the price. 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 additional citrus fruit 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 additional citrus fruit 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 0 element. The switch should not be considered process coding - no conditionals or other detailed coding - but calls to methods in the program. 6) Your classes must be coded with correct encapsulation: private/protected attributes, and value validation. 7) There should be appropriate overloading and overriding methods. Style and Documentation: Make sure your Java program is using the recommended style such as: - Javadoc comment up front with your name as author, date, and brief purpose of the program. - Comments for variables and blocks of code to describe major functionality (refer to the Documentation of Programs found in Week 1). - Meaningful variable names and prompts - no single character that is meaningless. - Class names are written in upper CamelCase - Constants are written in All Capitals - Use proper spacing and empty lines to make code more user-friendly, readable. You should capture and label screen captures associated with compiling your code and running a passing and failing test cases for each functionality. Sample run 1: MENU 1: Order a Gift Basket 2: Change Gift Basket 3: Display Gift Basket 4: Display all Gift Baskets 9: Exit progran Enter your selection: 3 No gift has been ordered yet MENU 1: Order a Gift Basket 2: Change 6ift Basket 3: Display Gift Basket 4: Display al1 Gift Baskets 9: Exit progran Enter your selection: 9 Thank you for using the progran. Goodbyel Sample run 2: MENU 1: Order a Gift Basket 2: Change Gift Basket 3: Display Gift Basket 4: Display all Gift Baskets. 9: Exit progran Enter your selection: 2 No eift has been ordered yet Sample run 3: MENU 1: order a 61ft sasket 2. Change 61ft lasket 3: Display 6ift Basket 4: Oisplay all Gift Baskets 9: Exit program Enter your selection: 1 Do you want Fruit Basket (1) or Sweets Basket (2): 1 Create order number [FB or SB for type of gift and three integers] FB343 What size do you want: S,M, or L: S Do you want citrus fruits included? 1 for yes/2 for no: 1 MENU 1: Order a Gift Basket 2: Change 6ift Basket 3: Display Gift Basket 4: Display all Gift Baskets 9: Exit progran Enter your selection: 3 Order Number: FB343 F8343: A snal1 FruitBasket with 6 Fruits with citrus costing \$25,98] MENU 1: Order a Gift Basket 2: Change Gift Basket 3: Display Gift Basket 4: Display all 61ft Baskets 9: Exit progran Enter your selection: 2 Which Gift do you want to change? FB343 Current gift size is: Snall What size do you want [enter same size or one of order sizes]? M Current basket contains citrus. Do you want citrus fruits included? 1 for yes/2 for no: 2 New order is F8343: A medium FruitBasket with 9 Fruits with no citrus costing $29.99 MENU 1: Order a 61ft Basket 2: Change 61ft Basket 3: Display Gift Basket 4: Display all 61ft Baskets 9: Exit program Enter your selection: 3 FB343: A mediun Fruitbasket with 9 Fruits with no citrus costing $29.99 MENU 1: Order a 61ft Basket 2: Change 61ft Basket 3: Display Gift Basket 4: Display all Gift Baskets 9: Exit progran Enter your selection: 9 Thank you for using the progran, Goodbyel