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
-
3 18 0.4
-
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...
-
Golden Harvest Foods makes jumbo biscuits and regular biscuits. The oven can cook at most 200 biscuits per day. Each jumbo biscuit requires 2 oz of flour, each regular biscuit requires 1 oz of flour,...
-
Suppose analysts agree that the losses resulting from climate change will reach x dollars 100 years from now. Use the concept of present value to explain why estimates of what needs to be spent today...
-
You plan to invest $1,000 and want to determine how much will be accumulated in five years if you earn interest at 8% per year. This is an example of a. future value of a single amount. b. future...
-
a. Would you consider the presentation to be a multiple-step income statement or a single-step income statement? Comment. b. Does it appear that there is a 100% ownership in all consolidated...
-
Question 1 1 mark) Question Given two complex numbers =2+i and w=-2+3: then Im{} is Answer O True O B False Question 2 (1 mark) Question The derivative of the function y = cosh #(x) is y' = 4 ( cosh...
-
1. The possible stock prices for XYZ Corporation over the next two years are: Year: 0 S =50 P = 1 Su = 60 Pu= Sd = 40 Pd= 2 Suu = 70 Puu = Sud = 50 Pud= Sdd = 30 Pdd = The risk-free interest rate is...
-
5 as a Express standard atmospheric pressure head, in meters of Ethylene glycol water Methanol. @ Air
-
7. In fig. both ends of the mano meter open to the atmosphere. Estimate the -specific gravity of fluid X, if the specific gravity of the oil is 0.8.
-
9. The 200 kg, 5 m wide rectangular gate shown in figure is hind hinged at B and leans an angle of 45 against the floor making to the horizontal. The gate is to be from its lower edge by applying...
-
A cylindrical shaft made of steel of yeild strength 700M Pa is subjected to static loads consisting of bending -moment 10KN-m-anda torsional moment 30KN -m. Determine the diameter of the shaft using...
-
9.2 Determine the thickness of a 120mm wide -uniform plate for safe continuous operation if the plate is to that be subjected to a tensile load has a maximum value of 250 KN and a -minimum value of...
-
(Corporate income tax) Last year Sanderson, Inc. had sales of $3.2 million. The firm's cost of goods sold came to $2.2 million, its operating expenses excluding depreciation of $102,000 were...
-
Charles owns an office building and land that are used in his trade or business. The office building and land were acquired in 1978 for $800,000 and $100,000, respectively. During the current year,...
-
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.
-
Given that the approximate frequency of \(\mathrm{G}_{4}{ }^{\#}=349 \mathrm{~Hz}\), what is the approximate frequency of \(\mathrm{G}_{3}{ }^{\#}\), rounded to the nearest whole number?
-
Given that the approximate frequency of \(\mathrm{D}_{4}=294 \mathrm{~Hz}\), what is the approximate frequency of \(D_{2}\), rounded to the nearest whole number?
-
Court plc has a defined benefits pension scheme for all its employees. Based on actuarial advice the company has previously made contributions of \( 2\) million per annum to the pension fund, being...
Study smarter with the SolutionInn App