Objectives This assignment requires you to design and implement a Graphic User Interface (GUI) for the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Objectives This assignment requires you to design and implement a Graphic User Interface (GUI) for the customers and products Order System (OS) by using Java Swing. Meanwhile, the file I/O and exception handling shall be implemented in the assignment. Background You are required to design, implement, and test an ordering system with the Graphic User Interface (GUI). The program shall 1) Load customers' data and products' data when the program starts. 2) Display GUI to help a customer to make new orders. 3) Handle possible exceptions during the interaction between the customer and the system. 4) Save the customer orders to a text file. The UML class diagram of OS is given below. You can add new classes, methods and/or attributes in the UML class diagram but CAN NOT delete any existing classes, attributes, and methods. Your java implementation must be consistent with the UML class diagram. Customer -code: String -name: String -address: String -phone: String +Customer() +getCode(): String Order 0..n -orderNumber: int -code: String -orderDate: String -orderDetails: ArrayList -total: double +Order() +calculateTotal (): void +readData(Scanner); void +writeData(Formatter): void +toString(): String interface>> MyFilelo 0..n 0..n +main(String[]); void +OrderSystem() +loadCustomers(): void +loadProducts(): void +saveOrders(): void Jo..n JTextArea JList 1..n Order System -customers: ArrayList -products: ArrayList -orders: ArrayList Do..n JButton Product -pname: String -supplier: String -category: String -stockQuantity: int -price: double +Product() +getName(): String OrderDetail -pname: String -price: double -orderQuantity: int -subTotal: double +Order Detail() +Order Detail(String, double, int): +calculateSubTotal(): void JFrame ActionListener interface>> ListSelectionListener A customers and products OS application initially loads data of customers and products from the text files. The format of a file customers.txt contains the data like ALFKI, Maria Anders, Obere Str. 57,030-0074321 ANATR, Ana Trujillo, Avda. de la Constitucin 2222,(5) 555-4729 ANTON, Antonio Moreno, Mataderos 2312,(5) 555-3932 Each row is a record of a customer. The fields of each customer consist of customer code, name, address, and phone number. Each field is separated by a character comma (,). The format of a file products.txt contains the data like Alice Mutton,Pavlova Ltd., Meat/Poultry,0,39.00 Aniseed Syrup, Exotic Liquids, Condiments, 13,10.00 Boston Crab Meat,New England Seafood Cannery, Seafood, 123,18.40 Camembert Pierrot,Gai paturage,Dairy Products, 19,34.00 WOLLONGONG Each row is a record of a product. The fields of a product consist of product name, supplier name, category, stock quantity, and unit price. Each field is separated by a character comma (,). In this assignment, we can assume that the input text files are customers.txt and products.txt. The detailed requests are as follows: 1. Update your UML diagram You shall update the UML class diagram by adding a new GUI class (for a new order). You can add classes, methods, and attributes. Please make sure your implementation is consistent with your UML class diagram. 2. Design and implement a GUI. The OrderSystem class shall contain Swing components, such as JFrame, JPanel, JLabel, JTextField, JButton, JList, JTextArea, etc. With the GUI, a customer can complete the order of products. 3. Customer ordering After initialization, the GUI of customers and products OS will be displayed. If a customer is selected from a list, the details of the customer are displayed. The customer can start a new window when clicks a button New Order and place a new order of products. a. The new order number and order date are automatically generated. b. The order number start from 1 when there is no order in the container orders. The new order number is the size of the container orders plus 1. c. The order date is the current system date. 4. Order products The customer can start to order any products via the GUI. When the customer selects a new product from a list, the product's details are displayed. a. The customer can click the button Order>> to place the product in the order list. The stock quantity of the product should be decreased by 1. Display the updated product details and order details. b. If the customer selects an ordered product, then clicks the button Unorder < The system shall be able to handle the exceptions during the interaction between the customer and the system. The exceptions may include invalid information when loading customers and products. Invalid data when a product is ordered. Check the sample processing in a file Assignment 3_sample Processing.pdf and watch the demonstration video for more details. Tasks Task 1 (1 mark): Update the UML class diagram based on the design given above. You are allowed to add new classes, more attributes, or more methods. Task 2 (7 marks): Implement the program according to the updated UML class diagram by using Java. The program shall Be consistent with the UML class diagram; Design and implement the GUI by using Java Swing. Please make sure to use JFrame, JPanel, JLabel, JTextField, JButton, JList, JTextArea, etc. in your GUI; Follow the conventions for naming all classes, variables, and methods, and provide sufficient comments; Be implemented by using the advanced OOP features such as inheritance, polymorphism, abstraction, interface, and/or class downcasting. Be able to initialise the customers and products OS; Be able to help the customer to complete the ordering via the GUI; Be able to handle possible exceptions during the ordering process; Be able to view or modify the current order list via the GUI; Be able to export the customer's orders to a single text file. Task 3 (2 marks): Compilation and test. Please compile your program with 'javac' and carefully test your program for all the requests. Test your program to all cases in GUI. Please do not define the package in your program (a special alert for students who use IDE to complete the assignment). Submission: Please submit your solution to Moodle (Assignment 3). Email submission is NOT accepted. Please submit an individual PDF document (OrderSystem.pdf) that contains your answers for Task 1 and Task 3. Please include the updated UML class diagram for Task 1. Include the snapshots to clearly shows the compilation, and the execution of your program for Task 2. You need to demonstrate all tasks with the GUI. Please submit all java codes for Task 2 and make sure the primary class's name is OrderSystem.java. Please submit the text file orders.txt created by your program in the test. NOTES: Enquiries about the marks can only be made within a maximum of 1 week after the assignment results are published. After 1 week the marks cannot be changed. Mark deductions: compilation errors, incorrect result, program is not up to spec, poor comments, poor indentation, meaningless identifiers, required numeric constants are not defined, the program Start the OrderSystem program, the GUI displayed like below. Order System Customer Code ALFKI ANATR ANTON AROUT BERGS BLAUS BLONP BOLID BONAP BOTTM New Order Assignment 3 sample processing Messages Customer details Save Order X If the user clicks the button New Order without select a customer code, the error message is displayed. Order System Customer Code ALFKI ANATR ANTON AROUT BERGS BLAUS BLONP BOLID BONAP BOTTM New Order Messages Select a customer Customer details I Save Order X A customer code is selected, display the customer details in the right area. Order System Customer Code ALFKI ANATR ANTON AROUT BERGS BLAUS BLONP BOLID BONAP BOTTM New Order Messages Customer details Customer code: AROUT Name: Thomas Hardy Address: 120 Hanover Sq. Phone: (171) 555-7788 Save Order X Click the button New Order, a new window for the ordering is displayed. When a product has zero stock quantity selected, click the button Order>> does not add the product to the order list. A message "The product is not in stock" is displayed in the message area. Order products Product Name Alice Mutton Aniseed Syrup Boston Crab Meat Camembert Pierrot Carnarvon Tigers Chai Chang Chartreuse verte Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Product name: Alice Mutton Supplier. Pavlova Ltd. Category: Meat/Poultry Stock quantity: 0 Price: 39.0 OK Order>> Unorder < < Cancel Messages The product is not in stock. Order I X When a product is in stock (stock quantity > 1), click the button Order>> can add the product name to the order list. The order details of the product are displayed. If the product has been ordered before, the program updates the order quantity and reduces the stock quantity for the product. Order products Product Name Alice Mutton Aniseed Syrup Boston Crab Meat Camembert Pierrot Carnarvon Tigers Chai Chang Chartreuse verte Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Product name: Aniseed Syrup Supplier: Exotic Liquids Category: Condiments Stock quantity: 12 Price: 10.0 4 OK Order>>> Unorder < < Messages The product is ordered. Cancel Order Aniseed Syrup Product name: Aniseed Syrup Price: 10.0 Order quantity: 1 Sub total: 10.0 Order products Product Name Alice Mutton Aniseed Syrup Boston Crab Meat Camembert Pierrot Carnarvon Tigers Chai Chang Chartreuse verte Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Product name: Boston Crab Meat Supplier. New England Seafood Cannery Category: Seafood Stock quantity: 120 Price: 18.4 BD Ok Order>>> Unorder < < Messages The product is ordered. Cancel Order Aniseed Syrup Boston Crab Meat Product name: Boston Crab Meat Price: 18.4 Order quantity:3 Sub total: 55.199999999999996 I X Order products Product Name Chang Chartreuse verte Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Chocolade Cite de Blaye Escargots de Bourgogne Filo Mix Flotemysost Geitost Product name: Filo Mix Supplier: G'day Mate Category: Grains/Cereals Stock quantity: 37 Price: 7.0 Ok Order>> Unorder < < Messages The product is ordered. Cancel Order Aniseed Syrup Boston Crab Meat Camembert Pierrot Carnarvon Tigers Chai Chang Chartreuse verte Chef Anton's Cajun Seasoning Chocolade Cite de Blaye Product name: Filo Mix Price: 7.0 Order quantity: 1 Sub total: 7.0 I X Objectives This assignment requires you to design and implement a Graphic User Interface (GUI) for the customers and products Order System (OS) by using Java Swing. Meanwhile, the file I/O and exception handling shall be implemented in the assignment. Background You are required to design, implement, and test an ordering system with the Graphic User Interface (GUI). The program shall 1) Load customers' data and products' data when the program starts. 2) Display GUI to help a customer to make new orders. 3) Handle possible exceptions during the interaction between the customer and the system. 4) Save the customer orders to a text file. The UML class diagram of OS is given below. You can add new classes, methods and/or attributes in the UML class diagram but CAN NOT delete any existing classes, attributes, and methods. Your java implementation must be consistent with the UML class diagram. Customer -code: String -name: String -address: String -phone: String +Customer() +getCode(): String Order 0..n -orderNumber: int -code: String -orderDate: String -orderDetails: ArrayList -total: double +Order() +calculateTotal (): void +readData(Scanner); void +writeData(Formatter): void +toString(): String interface>> MyFilelo 0..n 0..n +main(String[]); void +OrderSystem() +loadCustomers(): void +loadProducts(): void +saveOrders(): void Jo..n JTextArea JList 1..n Order System -customers: ArrayList -products: ArrayList -orders: ArrayList Do..n JButton Product -pname: String -supplier: String -category: String -stockQuantity: int -price: double +Product() +getName(): String OrderDetail -pname: String -price: double -orderQuantity: int -subTotal: double +Order Detail() +Order Detail(String, double, int): +calculateSubTotal(): void JFrame ActionListener interface>> ListSelectionListener A customers and products OS application initially loads data of customers and products from the text files. The format of a file customers.txt contains the data like ALFKI, Maria Anders, Obere Str. 57,030-0074321 ANATR, Ana Trujillo, Avda. de la Constitucin 2222,(5) 555-4729 ANTON, Antonio Moreno, Mataderos 2312,(5) 555-3932 Each row is a record of a customer. The fields of each customer consist of customer code, name, address, and phone number. Each field is separated by a character comma (,). The format of a file products.txt contains the data like Alice Mutton,Pavlova Ltd., Meat/Poultry,0,39.00 Aniseed Syrup, Exotic Liquids, Condiments, 13,10.00 Boston Crab Meat,New England Seafood Cannery, Seafood, 123,18.40 Camembert Pierrot,Gai paturage,Dairy Products, 19,34.00 WOLLONGONG Each row is a record of a product. The fields of a product consist of product name, supplier name, category, stock quantity, and unit price. Each field is separated by a character comma (,). In this assignment, we can assume that the input text files are customers.txt and products.txt. The detailed requests are as follows: 1. Update your UML diagram You shall update the UML class diagram by adding a new GUI class (for a new order). You can add classes, methods, and attributes. Please make sure your implementation is consistent with your UML class diagram. 2. Design and implement a GUI. The OrderSystem class shall contain Swing components, such as JFrame, JPanel, JLabel, JTextField, JButton, JList, JTextArea, etc. With the GUI, a customer can complete the order of products. 3. Customer ordering After initialization, the GUI of customers and products OS will be displayed. If a customer is selected from a list, the details of the customer are displayed. The customer can start a new window when clicks a button New Order and place a new order of products. a. The new order number and order date are automatically generated. b. The order number start from 1 when there is no order in the container orders. The new order number is the size of the container orders plus 1. c. The order date is the current system date. 4. Order products The customer can start to order any products via the GUI. When the customer selects a new product from a list, the product's details are displayed. a. The customer can click the button Order>> to place the product in the order list. The stock quantity of the product should be decreased by 1. Display the updated product details and order details. b. If the customer selects an ordered product, then clicks the button Unorder < The system shall be able to handle the exceptions during the interaction between the customer and the system. The exceptions may include invalid information when loading customers and products. Invalid data when a product is ordered. Check the sample processing in a file Assignment 3_sample Processing.pdf and watch the demonstration video for more details. Tasks Task 1 (1 mark): Update the UML class diagram based on the design given above. You are allowed to add new classes, more attributes, or more methods. Task 2 (7 marks): Implement the program according to the updated UML class diagram by using Java. The program shall Be consistent with the UML class diagram; Design and implement the GUI by using Java Swing. Please make sure to use JFrame, JPanel, JLabel, JTextField, JButton, JList, JTextArea, etc. in your GUI; Follow the conventions for naming all classes, variables, and methods, and provide sufficient comments; Be implemented by using the advanced OOP features such as inheritance, polymorphism, abstraction, interface, and/or class downcasting. Be able to initialise the customers and products OS; Be able to help the customer to complete the ordering via the GUI; Be able to handle possible exceptions during the ordering process; Be able to view or modify the current order list via the GUI; Be able to export the customer's orders to a single text file. Task 3 (2 marks): Compilation and test. Please compile your program with 'javac' and carefully test your program for all the requests. Test your program to all cases in GUI. Please do not define the package in your program (a special alert for students who use IDE to complete the assignment). Submission: Please submit your solution to Moodle (Assignment 3). Email submission is NOT accepted. Please submit an individual PDF document (OrderSystem.pdf) that contains your answers for Task 1 and Task 3. Please include the updated UML class diagram for Task 1. Include the snapshots to clearly shows the compilation, and the execution of your program for Task 2. You need to demonstrate all tasks with the GUI. Please submit all java codes for Task 2 and make sure the primary class's name is OrderSystem.java. Please submit the text file orders.txt created by your program in the test. NOTES: Enquiries about the marks can only be made within a maximum of 1 week after the assignment results are published. After 1 week the marks cannot be changed. Mark deductions: compilation errors, incorrect result, program is not up to spec, poor comments, poor indentation, meaningless identifiers, required numeric constants are not defined, the program Start the OrderSystem program, the GUI displayed like below. Order System Customer Code ALFKI ANATR ANTON AROUT BERGS BLAUS BLONP BOLID BONAP BOTTM New Order Assignment 3 sample processing Messages Customer details Save Order X If the user clicks the button New Order without select a customer code, the error message is displayed. Order System Customer Code ALFKI ANATR ANTON AROUT BERGS BLAUS BLONP BOLID BONAP BOTTM New Order Messages Select a customer Customer details I Save Order X A customer code is selected, display the customer details in the right area. Order System Customer Code ALFKI ANATR ANTON AROUT BERGS BLAUS BLONP BOLID BONAP BOTTM New Order Messages Customer details Customer code: AROUT Name: Thomas Hardy Address: 120 Hanover Sq. Phone: (171) 555-7788 Save Order X Click the button New Order, a new window for the ordering is displayed. When a product has zero stock quantity selected, click the button Order>> does not add the product to the order list. A message "The product is not in stock" is displayed in the message area. Order products Product Name Alice Mutton Aniseed Syrup Boston Crab Meat Camembert Pierrot Carnarvon Tigers Chai Chang Chartreuse verte Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Product name: Alice Mutton Supplier. Pavlova Ltd. Category: Meat/Poultry Stock quantity: 0 Price: 39.0 OK Order>> Unorder < < Cancel Messages The product is not in stock. Order I X When a product is in stock (stock quantity > 1), click the button Order>> can add the product name to the order list. The order details of the product are displayed. If the product has been ordered before, the program updates the order quantity and reduces the stock quantity for the product. Order products Product Name Alice Mutton Aniseed Syrup Boston Crab Meat Camembert Pierrot Carnarvon Tigers Chai Chang Chartreuse verte Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Product name: Aniseed Syrup Supplier: Exotic Liquids Category: Condiments Stock quantity: 12 Price: 10.0 4 OK Order>>> Unorder < < Messages The product is ordered. Cancel Order Aniseed Syrup Product name: Aniseed Syrup Price: 10.0 Order quantity: 1 Sub total: 10.0 Order products Product Name Alice Mutton Aniseed Syrup Boston Crab Meat Camembert Pierrot Carnarvon Tigers Chai Chang Chartreuse verte Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Product name: Boston Crab Meat Supplier. New England Seafood Cannery Category: Seafood Stock quantity: 120 Price: 18.4 BD Ok Order>>> Unorder < < Messages The product is ordered. Cancel Order Aniseed Syrup Boston Crab Meat Product name: Boston Crab Meat Price: 18.4 Order quantity:3 Sub total: 55.199999999999996 I X Order products Product Name Chang Chartreuse verte Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Chocolade Cite de Blaye Escargots de Bourgogne Filo Mix Flotemysost Geitost Product name: Filo Mix Supplier: G'day Mate Category: Grains/Cereals Stock quantity: 37 Price: 7.0 Ok Order>> Unorder < < Messages The product is ordered. Cancel Order Aniseed Syrup Boston Crab Meat Camembert Pierrot Carnarvon Tigers Chai Chang Chartreuse verte Chef Anton's Cajun Seasoning Chocolade Cite de Blaye Product name: Filo Mix Price: 7.0 Order quantity: 1 Sub total: 7.0 I X
Expert Answer:
Answer rating: 100% (QA)
Solutions Step1 Here is a more indepth solution with code snippets to guide you in creating the program as specified in your requirements Class Diagram The first step is to create a class diagram that ... View the full answer
Related Book For
Project Management The Managerial Process
ISBN: 9781260570434
8th Edition
Authors: Eric W Larson, Clifford F. Gray
Posted Date:
Students also viewed these programming questions
-
Suppose a market could be either a monopoly or a perfectly competitive market. Suppose that in either case the demand curve can be written as d = 100 2. Suppose further that the marginal cost of...
-
g(x)= 2. Given x+2x-3 x-4, answer each part: a. Identify the domain using interval notation. b. Locate the x- and y-intercepts. Express each as a coordinate pair. c. What are the vertical...
-
for the equality test for M and N. The question concerns how to represent multisets of strings within ML. For each of the given data representations (a), (b) and (c) describe how you would implement...
-
Inverse permutation. Write a program that reads in a permutation of the integers 0 to n-1 from n command-line arguments and prints the inverse permutation. (If the permutation is in an array a[], its...
-
On seeing her newborn baby for the first time, Caroline exclaimed, "Why is she so out of proportion?" What observations prompted Caroline to ask this question? Explain why her baby's appearance is...
-
For a recent year, the balance sheet for The Campbell Soup Company (CPB) includes accrued expenses of $604 million. The income before taxes for Campbell for the year was $849 million. a. Assume the...
-
What is ethnocentrism? How does it affect a firm that seeks to enter a foreign market?
-
Account analysis method. Lorenzo operates a car wash. Incoming cars are put on an automatic conveyor belt. Cars are washed as the conveyor belt carries them from the start station to the finish...
-
draw a diagram to show that there are two tangent lines to the parabola y=x that pass through the point (0,-25). find thr coordinates of the point where these tangent lines intersect the parabola MY...
-
Beth and Kate are in partnership. Their financial year ends on 31 December. On 1 January 205 their capitals were: Beth $90,000 and Kate $70,000. The uncompleted current accounts for the year ended 31...
-
Directions Select a charitable organization that you feel would be a good partner for Radio Flyer. Write a brief summary of the charity's mission statement, the efforts of your selected charitable...
-
Tickitt & Run are the auditors of BigBoy PLC and have been asked as a special-purpose audit engagement to express an opinion on the present liquidity of the company and, in particular, the ability of...
-
Are nonregistered public accounting firms required to have external peer reviews? Explain.
-
Produce a table with two columns and sufficient rows; in the first column list the key matters that should be included in inventory count instructions. In the second column give a brief indication...
-
Consider the following statements and explain why they may be true or false. (a) If the analytical review discloses no variations from the previous year, the auditor need not enquire further. (b)...
-
An employee who believes that he or she has been unfairly discharged should seek access to his or her employment contract (if applicable), employee handbook, human resources policies and procedures,...
-
Question 3 The following is the account balances at 1 jan 2021 Share Capital -Preference (5%, $100 par, non cumulative, 5,000 shares authorized) Share Capital-Ordinary ($55 stated value, 300,000...
-
If you want to solve a minimization problem by applying the geometric method to the dual problem, how many variables and problem constraints must be in the original problem?
-
Place in order the following countries in terms of what you think would be the least to most corrupt: United States, Denmark, Saudi Arabia, Canada, Australia, France, China, Thailand, Botswana, Chile...
-
What is the difference between avoiding a risk and retaining a risk?
-
1 . Why is it important to identify the critical path before starting a project? 2 . On what kind of projects would the critical path be irrelevant?
-
Determine whether \(G\) raph \(Q_{2}\) is a spanning tree of Graph \(Q\). If not, explain how you know. J k [m
-
Determine whether Graph \(Q_{1}\) is a spanning tree of Graph \(Q\). If not, explain how you know. m n
-
List three unused (solid) edges from Graph \(O\) that cannot be used to complete the spanning tree. A student has been asked to construct a spanning tree for Graph \(O\), as shown in the figure. The...
Study smarter with the SolutionInn App