Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description: Sahara Green's You have been recently employed by Sahara Greens, a fresh produce store which specialises in selling the freshest local fruits

image text in transcribedimage text in transcribedimage text in transcribed

Problem Description: Sahara Green's You have been recently employed by Sahara Greens, a fresh produce store which specialises in selling the freshest local fruits and vegetables at the most affordable prices. This store's vision is to provide its customers with up-to-date information about all available products and always maintain enough stock so there is least wastage and, hence, guarantee freshness. In order for this to be realised, they need a system that keeps track of all available stock and the sell-by dates for these vegetables so that they are sold as early as possible to maintain its company's vision for freshness and affordability. Freshness is achieved if products are sold by their sell-by date. The sell-by date indicates the date by which the freshness is guaranteed. By company policy, the sell-by date is within two days of purchase. Affordability of these products to its customers is achieved if products are not wasted therefore preventing loss for the business. This gain is passed on to the customers in terms of affordable prices. For each fruit or vegetable (product), Sahara Green keeps the following information: product code (int) product name (String) . cost (double) quantity (int) sell-by date (Date) You have been tasked to create a program that allows Sahara Green to keep inventory of all products and generate a few predefined reports. The system should allow the user (employees) to: 1. Add product details to the system. 2. Search and edit/update the product cost. 3. Search and edit/update the product quantity. 4. Search for a product and display all details for that product. 5. Search and list all products that must be sold within two days (current day) as per the company policy to guarantee freshness. 6. Display a list of all products. Product Class After discussions with your team, you have come up with the following classes: CSC621-Data Structures & Algorithms Semester 1- 2022 code: int Node name:String head: Node LinkedList() LinkedList cost:double quantity: double sellby:Date next:Node Node() getName():String getCost():double isEmpty(): boolean isFull(): boolean insert(code:int, name:String, cost:double, quantity:double, sellby: Date): boolean update_cost(code:int, newcost: double) update_quantity(code:int, newquantity: double) search(code:int) mustsell(); display(); setName(name: String) setCost(cost:double) getQuantity():double setQuantity(quantity:double) getCode():int setCode(code:int) getSellby(): Date setSellby(sellby: Date) getNext():Node setNext(next: Node) Main(); Main Implementation You are to create this system in Java using a singly linked list data structure where each node in your linked list represents a product sold by Sahara Green. Read the problem description carefully and use the class diagram given above to complete the implementation. Your program must satisfy the following: 1. Design a menu based program with these choices (you may either use a number or string/character menu similar to your labs): a. Insert - if the user chooses this option, the program will ask the user for the product details and add this product to the linked list. You may select any insertion method: insert at the head, tail or middle. b. Update Cost - if the user chooses this option, the program will ask the user for the product code for which they want to update the cost and the new cost. This information will be used to search the linked list for the product and then update its cost. c. Update Quantity - if the user chooses this option, the program will ask the user for the product code for which they want to update the quantity and the new quantity. This information will be used to search the linked list for the product and then update its quantity. d. Search this option allows the user to search for a product using its code. Once a code is entered, the program searches for the code and displays all its details. If the product code is not found, an appropriate message must be displayed. Use a neat, tabular format when displaying items. Add lines and tab spaces to separate products. e. Must Sell Products - when this option is chosen, the program must look through all items and display those products which must be sold within 2 days (+2 days) from now, where now is the current date. You do not need to ask the user to enter a date. Use the system date and display all items whose sell-by date is +2 days from now). Use a neat, tabular format when displaying items. Add lines and tab spaces to separate products. f. Display - this option displays all the products and product details in the system. Use a neat, tabular format when displaying items. Add lines and tab spaces to separate products. g. Quit this option terminates the program. Coding Guidelines Ensure you meet the following coding requirements: Use proper indentation. Use comments where possible. Use two decimal places when currencies. Use validation to prevent input errors. Catch input errors and display appropriate error messages allowing the user to re-enter data. Use proper formatting for outputs so that data can be read easily.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Usability

Authors: Jakob Nielsen, Raluca Budiu

1st Edition

0133122131, 9780133122138

More Books

Students also viewed these Programming questions