Question
Sale Management System using ArrayList data structure INTRODUCTION Your will be using ArrayList data struture for implementing a small Sale Management System (SMS) in Java
Sale Management System using ArrayList data structure INTRODUCTION Your will be using ArrayList data struture for implementing a small Sale Management System (SMS) in Java language. SMS manages information about products. These information are: About a product: 1. pcode (string): the code of the product (this should be unique for the product). 2. pro_name (string): the name of the product. 3. quantity (integer): the number of products with the same code in a shop at beginning of a day. 4. saled (integer): the number of products with the same code, which are saled in the day. Condition: saled quantity. 5. price (double): The price of the product. YOUR TASKS You should use ArrayList to store data for products. On running, your program displays the menu as below: Product list: 1.1. Load data from file 1.2. Input & add to the end 1.3. Display data 1.4. Save product list to file 1.5. Search by pcode 1.6. Delete by pcode 1.7. Sort by pcode 1.8. Add after position k 1.9. Delete the node after the node having code = xCode Tasks explanation Product list 1.1. Load data from file Allow a user to input the file name that contains information of products. The content of the file may be P03 | Sugar | 12 | 3 | 25.1 P01 | Miliket | 10 | 5 | 5.2 P02 | Apple | 5 | 2 | 4.3 P05 | Rose | 7 | 6 | 15.4 P07 | Beer | 11 | 3 | 12.2 P04 | Book | 9 | 5 | 5.2 The first line means that: pcode = P03, pro_name = Sugar, quantity = 12, saled = 3 and price = 25.1 1.2. Input & add to the end Allow a user to add new information about a product. After checking validation of data (including that the pcode could not be duplicated), the product is added to the end of the list. 1.3. Display data Display data in format: pcode | pro_name | quantity | saled | price | value where value = price*saled For example after loading the above file, this option give the output below: code | Pro_name | Quantity | saled | Price | Value ------------------------------------------------------------------- P03 | Sugar | 12 | 3 | 25.1 | 75.3 P01 | Miliket | 10 | 5 | 5.2 | 26.0 P02 | Apple | 5 | 2 | 4.3 | 8.6 P05 | Rose | 7 | 6 | 15.4 | 92.4 P07 | Beer | 11 | 3 | 12.2 | 36.6 P04 | Book | 9 | 5 | 5.2 | 26.0 1.4. Save product list to file Allow a user to input the file name and save the product list to the file. The information and format like the option 1.3. 1.5. Search by pcode Write the function: Node search(String xCode) {} which return reference to the node whose info contains the product with pcode = xcode. Allow a user to input the pcode to be searched and display the result: found or not found. 1.6. Delete by pcode Write the function: void dele(String xCode) {} which deletes the node whose info contains the product with pcode = xCode. Allow a user to input the pcode to be deleted and then delete the product having that pcode. 1.7. Sort by pcode 1.8. Add after position k The position of the first element is 0, the second's is 1 1.9. Delete the node after the node having code = xCode
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started