OBJECTIVE To implement a java program to display the menu of a shop and take the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
OBJECTIVE To implement a java program to display the menu of a shop and take the order from the user. The program should calculate the net price of the order based on the user's selection. BACKGROUND You are required to design and implement a simple java program for a new online shop. As a new shop, it has only ten items available and can support only one customer each time. The customer can pick up different items with different qualities. The program will automatically calculate the GST tax, the total price and the net price for the customer. CODING REQUIREMENTS Write a Java program with four classes to calculate the implement the online shop Your program shall be implemented using material covered in lectures 1-13. You can use the methods predefined in Math class. Your program shall be compliable by Java JDK. Your program shall have four classes that contains static and/or non-static methods. You should follow common programming practices and give meaningful identifiers to declared variables. Your program shall use the printf() method to print the final output. In this assignment, you can presume that the user input always corrects (input verification is not required). The program shall perform all calculations with double precision. All prices shall be displayed with two decimal point precision. Examples of the program outputs: iMac:A3 fenghui$ javac Shop.java iMac:A3 fenghuis java Shop The Item Apple is added to the menu. The Item Pear is added to the menu. The Item Banana is added to the menu. The Item Grape is added to the menu. The Item Apple is in the menu already. The Item Bread is added to the menu. The Item Milk is added to the menu. The Item Salt is added to the menu. The Item Pepsi is added to the menu. The Item Chilli is added to the menu. The Item Egg is added to the menu. The menu is full and the new item Coke can't be added. Welcome to the shop. Here is our menu. ID Name UnitPrice ($) Apple Pear 0 1 2 Banana Grape Bread Milk 3 4 5 6 Salt 7 Pepsi 8 Chilli 9 Egg 0.99 1.49 2.99 9.99 3.99 4.99 2.49 2.29 11.99 3.49 Please input the Item ID to add it to your order (-1 for checkout):0 Please input the quality for the selected item (>=1):1 Page 1 ID 1 2 3 4 5 6 7 8 9 ID 1 2 3 4 Apple Nome UnitPrice ($) 0.99 1.49 Pear Banana 2.99 Pepsi Chilli 11.99 Egg 3.49 Please input the Item ID to add it to your order (-1 for checkout):2 Please input the quality for the selected item (>=1):2 Nome UnitPrice ($) 5 6 7 8 9 Grape Bread Milk Salt Apple Pear 9.99 3.99 4.99 2.49 2.29 Banana Grape Bread Milk Salt Pepsi Chilli Egg 0.99 1.49 2.99 9.99 3.99 4.99 2.49 2.29 11.99 3.49 Please input the Item ID to add it to your order (-1 for checkout):2 Please input the quality for the selected item (>=1):3 Page 2 ID 0 1 2 3 4 5 6 7 8 9 ID 0 1 2 3 Please input the Item ID to add it to your order (-1 for checkout):8 Please input the quality for the selected item (>=1):3 Name UnitPrice ($) Apple Pear Banana Grape Bread Milk Salt 4 5 Nane UnitPrice (5) 0.99 1.49 & 9 Apple Pear Banana Grape Bread Milk Salt Pepsi Chilli Egg 6 7 Pepsi Chilli Egg 0 2 9.99 3.99 4.99 2.49 2.29 11.99 3.49 0.99 1.49 2.99 9.99 3.99 4.99 2.49 2.29 11.99 3.49 Please input the Item ID to add it to your order C-1 for checkout):-1 Here is the summary of your order. ID Name UnitPrice Quality Price ($) 1 Apple 0.99 0.99 Banana 14.95 Chilli 5 2.99 11.99 3 35.97 Total Price $51.91, GST- $5.19, Net Price $57.10 Thanks for your shopping, see you next time. Page 3 The program structure shall be based on the UML class diagram shown below. -int ID (read only) -String name -double unitPrice -int quantity +Item() +Item(int id, String name, double unitPrice, int quantity) +Item(item sourceltem, int quantity) +getID() int +getName():String +getUnitPrice():double Item +getQuantity():int +increaseQuantity(int more):void +displayItem():void -Item] items -int totalltem 10 has Menu +Menu() +addItem ToMenu(item newltem):void +getMenultem(int id):ltern +get Totalltem(int +displayMenu():void 1 0.. has contains 1 Order -ArrayList ordereditems -double GSTRATE=0.1 (read only) -double gst -double totalPrice +Order() +additerToOrder(Item newltem):void +getOrdereditems():ArrayList +getGST():double +get TotalPrice():double +displayOrder():void -Menu menu -Order order 1 contains Shop -createMenu():void -takeOrder():void -checkout():void +main(String[] args):void +Shop() Class Item is used to model a single item. Each Item object has four attributes, i.e., item ID, item name, the unit price of the item, and the item quantity. The +Item(int id, String name, double unitPrice, int quantity) is the constructor with four formal parameters. The +Item() is the default constructor. The +Item(Item sourceltem, int quantity) is the clone constructor of Class Item. Once a customer selects an item from the menu and specify the quantity, the clone constructor will be called to create a clone Item object based on the sourceItem (i.e., item displays in the menu) and the specified quantity. Then the clone Item object will be added to the customer's order. So any further modifications on the items in the customer's order will not affect the items in the menu. The +increaseQuantity(int more).void method will increase the quantity of a selected item in the customer's order. When the customer selects the same item from the menu, the increaseQuantity (int more):void method will be called to update the quantity of the item, i.e., each item will have only one instance in the order. The +displayItem():void method will display a single item using the format in the example, i.e., nine fixed space for each column, and two decimal point precision for all numbers. Class Order is used to model the customer's order. Each Order object has four attributes, i.e., the ordered items (ArrayList), the GSTRATE (a constant), the GST tax of the order, and the total price of the order. The +Order() is the default constructor which will initialise the orderedItems to an empty ArrayList, GSTRATE to 0.1, both gst and totalPrice to zero. The +addItem To Order (Item newItem):void method will be called once the customer adds an item to the order. If the item has no instance in the order, then the item will be added to the order straightway. However, if the item has an instance in the order, then the method will only update the quantity of the item. Once the item is added to the order, the method will also update the total price and the GST tax of the order accordingly. The displayOrder():void method will display the entire order using the format in the example, i.e., nine fixed space for each column, two decimal point precision for all numbers. Class Menu is used to model the shop menu, which contains two attributes, i.e., the Item array with maximal ten elements and the actual item number the menu contains. The Memi() is the default constructor, which will create a 1D array to contains ten Item objects maximally and initialise the totalltem to zero. The +addItem ToMenu(Item newItem):void method will be called to add an item to the menu (i.e., the Item array). If the menu has less ten items and if the item is not listed in the menu, then the item will be added to the menu. If the item already is contained in the menu, then the method will not add the item again to the menu but just indicate the item was in the menu already. If the menu has ten items, no more item can be added to the menu. The +getMenuItem(int id):Item method will return an Item object based on the item's id. This method can be called when to check if an item is contained in the menu or not. The +getTotalItem(): int method will return the actual item number contained in the menu. The +displayMenu():void method will display the entire menu using the format in the example, i.e., nine fixed space for each column, two decimal point precision for all numbers. Class Shop is the primary class and used to display the menu and take the customer's order. It has two attributes, i.e., the shop menu and the customer's order. The +main(String[] args):void is the method to start the program. The +Shop() is the constructor, which initialise an empty menu and an empty order. The-createMenu():void method is a private method and will be called to create the shop menu with the hardcode. The implementation of the -createMenu():void method is already provided. Please download it from Moodle and DON'T modify the method implementation. The-takeOrder():void method is a private method and will be called to add the customer's selection to the order. If the item is not contained by the order, then the item will be added to the order directly. If the item is already contained by the order, then the quantity of the item will be updated accordingly. The process will be repeated until the customer inputs -1 in the item selection (see the example and the video introduction for details). The -checkout():void method is a private method and will be called to checkout. The method will calculate the GST tax, the total price and the net price (GST tax + total Price) of the order and display the order summary using the format in the example, i.e., nine fixed space for each column, two decimal point precision for all numbers. TASKS Task 1 (8 marks): Implement your java program based on the UML class diagram. The program shall be consistent with the UML class diagram; follow the conventions for naming all classes, variables, and methods; provide sufficient comments; use proper blank spaces, indentation and braces to make your code easy to read and understand; follow the specified steps in main() method to complete the test i.e., create an object of the Shop class; 1. 2. 3. 4. call the creatMenu() method with the Shop object to create the shop menu; call the takeOrder() method with the Shop object to take the order from the customer. This process should be repeated until the customer inputs -1 to complete the order; once the customer completes the order, call the checkout() method to calculate the GST tax, the total price, the net price (GST tax+ total price), and display the order summary (see the example for the summary format and details). the program outputs must be exactly same as the example. Task 2 (2 marks): Compilation and test. You should compile and test your program by using two different cases. The first testing case must use the exact same inputs in the examples and the results must be exact same as the examples. The second testing case must choose a different combination of items selection to make sure, 1. At least four items are selected; 2. One item is selected for twice with different qualities; 3. The total price, the GST tax and the net price can be calculated based on the customer's selection. Please carefully compile and test your program and make sure your program can pass the compilation by using "javac" command. OBJECTIVE To implement a java program to display the menu of a shop and take the order from the user. The program should calculate the net price of the order based on the user's selection. BACKGROUND You are required to design and implement a simple java program for a new online shop. As a new shop, it has only ten items available and can support only one customer each time. The customer can pick up different items with different qualities. The program will automatically calculate the GST tax, the total price and the net price for the customer. OBJECTIVE To implement a java program to display the menu of a shop and take the order from the user. The program should calculate the net price of the order based on the user's selection. BACKGROUND You are required to design and implement a simple java program for a new online shop. As a new shop, it has only ten items available and can support only one customer each time. The customer can pick up different items with different qualities. The program will automatically calculate the GST tax, the total price and the net price for the customer. CODING REQUIREMENTS Write a Java program with four classes to calculate the implement the online shop Your program shall be implemented using material covered in lectures 1-13. You can use the methods predefined in Math class. Your program shall be compliable by Java JDK. Your program shall have four classes that contains static and/or non-static methods. You should follow common programming practices and give meaningful identifiers to declared variables. Your program shall use the printf() method to print the final output. In this assignment, you can presume that the user input always corrects (input verification is not required). The program shall perform all calculations with double precision. All prices shall be displayed with two decimal point precision. CODING REQUIREMENTS Write a Java program with four classes to calculate the implement the online shop Your program shall be implemented using material covered in lectures 1-13. You can use the methods predefined in Math class. Your program shall be compliable by Java JDK. Your program shall have four classes that contains static and/or non-static methods. You should follow common programming practices and give meaningful identifiers to declared variables. Your program shall use the printf() method to print the final output. In this assignment, you can presume that the user input always corrects (input verification is not required). The program shall perform all calculations with double precision. All prices shall be displayed with two decimal point precision. Examples of the program outputs: iMac:A3 fenghui$ javac Shop.java iMac:A3 fenghuis java Shop The Item Apple is added to the menu. The Item Pear is added to the menu. The Item Banana is added to the menu. The Item Grape is added to the menu. The Item Apple is in the menu already. The Item Bread is added to the menu. The Item Milk is added to the menu. The Item Salt is added to the menu. The Item Pepsi is added to the menu. The Item Chilli is added to the menu. The Item Egg is added to the menu. The menu is full and the new item Coke can't be added. Welcome to the shop. Here is our menu. ID Name UnitPrice ($) Apple Pear 0 1 2 Banana Grape Bread Milk 3 4 5 6 Salt 7 Pepsi 8 Chilli 9 Egg 0.99 1.49 2.99 9.99 3.99 4.99 2.49 2.29 11.99 3.49 Please input the Item ID to add it to your order (-1 for checkout):0 Please input the quality for the selected item (>=1):1 Page 1 ID 1 2 3 4 5 6 7 8 9 ID 1 2 3 4 Apple Nome UnitPrice ($) 0.99 1.49 Pear Banana 2.99 Pepsi Chilli 11.99 Egg 3.49 Please input the Item ID to add it to your order (-1 for checkout):2 Please input the quality for the selected item (>=1):2 Nome UnitPrice ($) 5 6 7 8 9 Grape Bread Milk Salt Apple Pear 9.99 3.99 4.99 2.49 2.29 Banana Grape Bread Milk Salt Pepsi Chilli Egg 0.99 1.49 2.99 9.99 3.99 4.99 2.49 2.29 11.99 3.49 Please input the Item ID to add it to your order (-1 for checkout):2 Please input the quality for the selected item (>=1):3 Page 2 ID 0 1 2 3 4 5 6 7 8 9 ID 0 1 2 3 Please input the Item ID to add it to your order (-1 for checkout):8 Please input the quality for the selected item (>=1):3 Name UnitPrice ($) Apple Pear Banana Grape Bread Milk Salt 4 5 Nane UnitPrice (5) 0.99 1.49 & 9 Apple Pear Banana Grape Bread Milk Salt Pepsi Chilli Egg 6 7 Pepsi Chilli Egg 0 2 9.99 3.99 4.99 2.49 2.29 11.99 3.49 0.99 1.49 2.99 9.99 3.99 4.99 2.49 2.29 11.99 3.49 Please input the Item ID to add it to your order C-1 for checkout):-1 Here is the summary of your order. ID Name UnitPrice Quality Price ($) 1 Apple 0.99 0.99 Banana 14.95 Chilli 5 2.99 11.99 3 35.97 Total Price $51.91, GST- $5.19, Net Price $57.10 Thanks for your shopping, see you next time. Page 3 Examples of the program outputs: iMac:A3 fenghui$ javac Shop.java iMac:A3 fenghuis java Shop The Item Apple is added to the menu. The Item Pear is added to the menu. The Item Banana is added to the menu. The Item Grape is added to the menu. The Item Apple is in the menu already. The Item Bread is added to the menu. The Item Milk is added to the menu. The Item Salt is added to the menu. The Item Pepsi is added to the menu. The Item Chilli is added to the menu. The Item Egg is added to the menu. The menu is full and the new item Coke can't be added. Welcome to the shop. Here is our menu. ID Name UnitPrice ($) Apple Pear 0 1 2 Banana Grape Bread Milk 3 4 5 6 Salt 7 Pepsi 8 Chilli 9 Egg 0.99 1.49 2.99 9.99 3.99 4.99 2.49 2.29 11.99 3.49 Please input the Item ID to add it to your order (-1 for checkout):0 Please input the quality for the selected item (>=1):1 Page 1 ID 1 2 3 4 5 6 7 8 9 ID 1 2 3 4 Apple Nome UnitPrice ($) 0.99 1.49 Pear Banana 2.99 Pepsi Chilli 11.99 Egg 3.49 Please input the Item ID to add it to your order (-1 for checkout):2 Please input the quality for the selected item (>=1):2 Nome UnitPrice ($) 5 6 7 8 9 Grape Bread Milk Salt Apple Pear 9.99 3.99 4.99 2.49 2.29 Banana Grape Bread Milk Salt Pepsi Chilli Egg 0.99 1.49 2.99 9.99 3.99 4.99 2.49 2.29 11.99 3.49 Please input the Item ID to add it to your order (-1 for checkout):2 Please input the quality for the selected item (>=1):3 Page 2 ID 0 1 2 3 4 5 6 7 8 9 ID 0 1 2 3 Please input the Item ID to add it to your order (-1 for checkout):8 Please input the quality for the selected item (>=1):3 Name UnitPrice ($) Apple Pear Banana Grape Bread Milk Salt 4 5 Nane UnitPrice (5) 0.99 1.49 & 9 Apple Pear Banana Grape Bread Milk Salt Pepsi Chilli Egg 6 7 Pepsi Chilli Egg 0 2 9.99 3.99 4.99 2.49 2.29 11.99 3.49 0.99 1.49 2.99 9.99 3.99 4.99 2.49 2.29 11.99 3.49 Please input the Item ID to add it to your order C-1 for checkout):-1 Here is the summary of your order. ID Name UnitPrice Quality Price ($) 1 Apple 0.99 0.99 Banana 14.95 Chilli 5 2.99 11.99 3 35.97 Total Price $51.91, GST- $5.19, Net Price $57.10 Thanks for your shopping, see you next time. Page 3 The program structure shall be based on the UML class diagram shown below. -int ID (read only) -String name -double unitPrice -int quantity +Item() +Item(int id, String name, double unitPrice, int quantity) +Item(item sourceltem, int quantity) +getID() int +getName():String +getUnitPrice():double Item +getQuantity():int +increaseQuantity(int more):void +displayItem():void -Item] items -int totalltem 10 has Menu +Menu() +addItem ToMenu(item newltem):void +getMenultem(int id):ltern +get Totalltem(int +displayMenu():void 1 0.. has contains 1 Order -ArrayList ordereditems -double GSTRATE=0.1 (read only) -double gst -double totalPrice +Order() +additerToOrder(Item newltem):void +getOrdereditems():ArrayList +getGST():double +get TotalPrice():double +displayOrder():void -Menu menu -Order order 1 contains Shop -createMenu():void -takeOrder():void -checkout():void +main(String[] args):void +Shop() The program structure shall be based on the UML class diagram shown below. -int ID (read only) -String name -double unitPrice -int quantity +Item() +Item(int id, String name, double unitPrice, int quantity) +Item(item sourceltem, int quantity) +getID() int +getName():String +getUnitPrice():double Item +getQuantity():int +increaseQuantity(int more):void +displayItem():void -Item] items -int totalltem 10 has Menu +Menu() +addItem ToMenu(item newltem):void +getMenultem(int id):ltern +get Totalltem(int +displayMenu():void 1 0.. has contains 1 Order -ArrayList ordereditems -double GSTRATE=0.1 (read only) -double gst -double totalPrice +Order() +additerToOrder(Item newltem):void +getOrdereditems():ArrayList +getGST():double +get TotalPrice():double +displayOrder():void -Menu menu -Order order 1 contains Shop -createMenu():void -takeOrder():void -checkout():void +main(String[] args):void +Shop() Class Item is used to model a single item. Each Item object has four attributes, i.e., item ID, item name, the unit price of the item, and the item quantity. The +Item(int id, String name, double unitPrice, int quantity) is the constructor with four formal parameters. The +Item() is the default constructor. The +Item(Item sourceltem, int quantity) is the clone constructor of Class Item. Once a customer selects an item from the menu and specify the quantity, the clone constructor will be called to create a clone Item object based on the sourceItem (i.e., item displays in the menu) and the specified quantity. Then the clone Item object will be added to the customer's order. So any further modifications on the items in the customer's order will not affect the items in the menu. The +increaseQuantity(int more).void method will increase the quantity of a selected item in the customer's order. When the customer selects the same item from the menu, the increaseQuantity (int more):void method will be called to update the quantity of the item, i.e., each item will have only one instance in the order. The +displayItem():void method will display a single item using the format in the example, i.e., nine fixed space for each column, and two decimal point precision for all numbers. Class Item is used to model a single item. Each Item object has four attributes, i.e., item ID, item name, the unit price of the item, and the item quantity. The +Item(int id, String name, double unitPrice, int quantity) is the constructor with four formal parameters. The +Item() is the default constructor. The +Item(Item sourceltem, int quantity) is the clone constructor of Class Item. Once a customer selects an item from the menu and specify the quantity, the clone constructor will be called to create a clone Item object based on the sourceItem (i.e., item displays in the menu) and the specified quantity. Then the clone Item object will be added to the customer's order. So any further modifications on the items in the customer's order will not affect the items in the menu. The +increaseQuantity(int more).void method will increase the quantity of a selected item in the customer's order. When the customer selects the same item from the menu, the increaseQuantity (int more):void method will be called to update the quantity of the item, i.e., each item will have only one instance in the order. The +displayItem():void method will display a single item using the format in the example, i.e., nine fixed space for each column, and two decimal point precision for all numbers. Class Order is used to model the customer's order. Each Order object has four attributes, i.e., the ordered items (ArrayList), the GSTRATE (a constant), the GST tax of the order, and the total price of the order. The +Order() is the default constructor which will initialise the orderedItems to an empty ArrayList, GSTRATE to 0.1, both gst and totalPrice to zero. The +addItem To Order (Item newItem):void method will be called once the customer adds an item to the order. If the item has no instance in the order, then the item will be added to the order straightway. However, if the item has an instance in the order, then the method will only update the quantity of the item. Once the item is added to the order, the method will also update the total price and the GST tax of the order accordingly. The displayOrder():void method will display the entire order using the format in the example, i.e., nine fixed space for each column, two decimal point precision for all numbers. Class Order is used to model the customer's order. Each Order object has four attributes, i.e., the ordered items (ArrayList), the GSTRATE (a constant), the GST tax of the order, and the total price of the order. The +Order() is the default constructor which will initialise the orderedItems to an empty ArrayList, GSTRATE to 0.1, both gst and totalPrice to zero. The +addItem To Order (Item newItem):void method will be called once the customer adds an item to the order. If the item has no instance in the order, then the item will be added to the order straightway. However, if the item has an instance in the order, then the method will only update the quantity of the item. Once the item is added to the order, the method will also update the total price and the GST tax of the order accordingly. The displayOrder():void method will display the entire order using the format in the example, i.e., nine fixed space for each column, two decimal point precision for all numbers. Class Menu is used to model the shop menu, which contains two attributes, i.e., the Item array with maximal ten elements and the actual item number the menu contains. The Memi() is the default constructor, which will create a 1D array to contains ten Item objects maximally and initialise the totalltem to zero. The +addItem ToMenu(Item newItem):void method will be called to add an item to the menu (i.e., the Item array). If the menu has less ten items and if the item is not listed in the menu, then the item will be added to the menu. If the item already is contained in the menu, then the method will not add the item again to the menu but just indicate the item was in the menu already. If the menu has ten items, no more item can be added to the menu. The +getMenuItem(int id):Item method will return an Item object based on the item's id. This method can be called when to check if an item is contained in the menu or not. The +getTotalItem(): int method will return the actual item number contained in the menu. The +displayMenu():void method will display the entire menu using the format in the example, i.e., nine fixed space for each column, two decimal point precision for all numbers. Class Menu is used to model the shop menu, which contains two attributes, i.e., the Item array with maximal ten elements and the actual item number the menu contains. The Memi() is the default constructor, which will create a 1D array to contains ten Item objects maximally and initialise the totalltem to zero. The +addItem ToMenu(Item newItem):void method will be called to add an item to the menu (i.e., the Item array). If the menu has less ten items and if the item is not listed in the menu, then the item will be added to the menu. If the item already is contained in the menu, then the method will not add the item again to the menu but just indicate the item was in the menu already. If the menu has ten items, no more item can be added to the menu. The +getMenuItem(int id):Item method will return an Item object based on the item's id. This method can be called when to check if an item is contained in the menu or not. The +getTotalItem(): int method will return the actual item number contained in the menu. The +displayMenu():void method will display the entire menu using the format in the example, i.e., nine fixed space for each column, two decimal point precision for all numbers. Class Shop is the primary class and used to display the menu and take the customer's order. It has two attributes, i.e., the shop menu and the customer's order. The +main(String[] args):void is the method to start the program. The +Shop() is the constructor, which initialise an empty menu and an empty order. The-createMenu():void method is a private method and will be called to create the shop menu with the hardcode. The implementation of the -createMenu():void method is already provided. Please download it from Moodle and DON'T modify the method implementation. The-takeOrder():void method is a private method and will be called to add the customer's selection to the order. If the item is not contained by the order, then the item will be added to the order directly. If the item is already contained by the order, then the quantity of the item will be updated accordingly. The process will be repeated until the customer inputs -1 in the item selection (see the example and the video introduction for details). The -checkout():void method is a private method and will be called to checkout. The method will calculate the GST tax, the total price and the net price (GST tax + total Price) of the order and display the order summary using the format in the example, i.e., nine fixed space for each column, two decimal point precision for all numbers. Class Shop is the primary class and used to display the menu and take the customer's order. It has two attributes, i.e., the shop menu and the customer's order. The +main(String[] args):void is the method to start the program. The +Shop() is the constructor, which initialise an empty menu and an empty order. The-createMenu():void method is a private method and will be called to create the shop menu with the hardcode. The implementation of the -createMenu():void method is already provided. Please download it from Moodle and DON'T modify the method implementation. The-takeOrder():void method is a private method and will be called to add the customer's selection to the order. If the item is not contained by the order, then the item will be added to the order directly. If the item is already contained by the order, then the quantity of the item will be updated accordingly. The process will be repeated until the customer inputs -1 in the item selection (see the example and the video introduction for details). The -checkout():void method is a private method and will be called to checkout. The method will calculate the GST tax, the total price and the net price (GST tax + total Price) of the order and display the order summary using the format in the example, i.e., nine fixed space for each column, two decimal point precision for all numbers. TASKS Task 1 (8 marks): Implement your java program based on the UML class diagram. The program shall be consistent with the UML class diagram; follow the conventions for naming all classes, variables, and methods; provide sufficient comments; use proper blank spaces, indentation and braces to make your code easy to read and understand; follow the specified steps in main() method to complete the test i.e., create an object of the Shop class; 1. 2. 3. 4. call the creatMenu() method with the Shop object to create the shop menu; call the takeOrder() method with the Shop object to take the order from the customer. This process should be repeated until the customer inputs -1 to complete the order; once the customer completes the order, call the checkout() method to calculate the GST tax, the total price, the net price (GST tax+ total price), and display the order summary (see the example for the summary format and details). the program outputs must be exactly same as the example. Task 2 (2 marks): Compilation and test. You should compile and test your program by using two different cases. The first testing case must use the exact same inputs in the examples and the results must be exact same as the examples. The second testing case must choose a different combination of items selection to make sure, 1. At least four items are selected; 2. One item is selected for twice with different qualities; 3. The total price, the GST tax and the net price can be calculated based on the customer's selection. Please carefully compile and test your program and make sure your program can pass the compilation by using "javac" command. TASKS Task 1 (8 marks): Implement your java program based on the UML class diagram. The program shall be consistent with the UML class diagram; follow the conventions for naming all classes, variables, and methods; provide sufficient comments; use proper blank spaces, indentation and braces to make your code easy to read and understand; follow the specified steps in main() method to complete the test i.e., create an object of the Shop class; 1. 2. 3. 4. call the creatMenu() method with the Shop object to create the shop menu; call the takeOrder() method with the Shop object to take the order from the customer. This process should be repeated until the customer inputs -1 to complete the order; once the customer completes the order, call the checkout() method to calculate the GST tax, the total price, the net price (GST tax+ total price), and display the order summary (see the example for the summary format and details). the program outputs must be exactly same as the example. Task 2 (2 marks): Compilation and test. You should compile and test your program by using two different cases. The first testing case must use the exact same inputs in the examples and the results must be exact same as the examples. The second testing case must choose a different combination of items selection to make sure, 1. At least four items are selected; 2. One item is selected for twice with different qualities; 3. The total price, the GST tax and the net price can be calculated based on the customer's selection. Please carefully compile and test your program and make sure your program can pass the compilation by using "javac" command.
Expert Answer:
Related Book For
Auditing and Assurance services an integrated approach
ISBN: 978-0132575959
14th Edition
Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Use normal job-order costing to calculate the balance in the ending Work-in-Process account and the Cost of Goods Sold account on 31 December 20X3 after any necessary adjustment(s). Sweet Memories...
-
Direct material variances solving for price and usage variances Fiber works lo 4, 5 Company is a manufacturer of fiberglass toy boats. The company has recently implemented a standard cost system and...
-
The following are ethical issues. What you would do if they occurred in your workplace. You overhear a staff member verbally abusing a young client. Two staff members are gossiping about the...
-
Earnings per share is not computed for a. Net income b. Comprehensive income c. Discontinued operations d. Extraordinary items
-
Activity based budget; kaizen improvements. Korna Company manufactures a product, gizmo that uses the following direct inputs: Korna has no direct materials inventory. All manufacturing overhead...
-
a) Find the first derivative. Based on your answer, discuss the function in terms of being increasing/decreasing, its convex or concave properties. b) Find the second derivative. Based on your...
-
Complete Alvins Music Inc.s (AMI) 2020 Form 1120, Schedule D, and Schedule G (if applicable) using the information provided below. Neither Form 4562 for depreciation nor Form 4797 for the sale of...
-
3 |v)=|+)+i^|-). Sz |y)=+)+i), Given a quantum state in S. basis states, write it as column vector, i.e., two (9).. . Also write bra, i.e., (y, of the state ly) in terms of a row vector. Recall you...
-
P. Nonius is the owner/manager of a company that owns several suburban shopping malls. The retail store lease contracts require the store tenants to pay a flat amount monthly, plus 0.05% of their...
-
The Betta Group reports taxable income in the amount of $625,000 and has a 30% tax rate. Additionally, the company estimates a deferred tax asset of $45,000 due to a book-tax difference in warranty...
-
Suppose a chain of electronics stores sells televisions. The weekly demand and supply models are given below. (Note that p is the price per television and q is the number of televisions demanded or...
-
Russell Corporation sold a parcel of land valued at $ 5 8 7 , 5 0 0 . Its basis in the land was $ 4 8 1 , 7 5 0 . For the land, Russell received $ 7 4 , 2 5 0 in cash in year 0 and a note providing...
-
A hardware store will run an advertising campaign using radio and newspaper. Every dollar spent on radio advertising will reach 70 people in the "Gen X" market, and 30 people in the "millennials"...
-
4. Raindrops hit the ground at a rate of 2 drops per second. An observatory has a raindrop sensing equipment. A signal is received by the computer with a maximum delay of 0.5 second after sensing a...
-
Cable Corporation is 60% owned by Anna and 40% owned by Jim, who are unrelated. It has noncash assets, which it sells to an unrelated purchaser for $100,000 in cash and $900,000 in installment...
-
Explain the difference between replacement sampling and nonreplacement sampling. Which method do auditors usually follow? Why?
-
For each of the following misstatements in property, plant, and equipment accounts, state an internal control that the client can implement to prevent the misstatement from occurring and a...
-
Describe what is meant by an operational audit.
-
Assume you are working on a project to improve customer service. Create a Pareto chart based on the information in the following table. Use the Pareto chart template from the companion website or...
-
Brainstorm two different quality related problems that you are aware of at your college or organization. Then review the charts found in the section of this chapter on the seven basic tools of...
-
Updating processes, policies, procedures, and knowledge bases is part of __________. A. updating organizational process assets B. archival C. updating project documents D. lessons learned
Study smarter with the SolutionInn App