Final, exam-like application

Write a Warehouse class for warehouse dispatcher instances.

In warehouses a product is characterized by a unique code (an integer), a product category (a string), a description (a string), a price (a double), a producer (a string), and an expiry date (a string with a “ddmmyyyy” format). (A) A warehouse has a name and its capacity is up to 2000 products.

A warehouse dispatcher should know all products in the warehouse. (B) For this, at creation time of a Warehouse instance all its products are read from “products.txt”, a file where information on products is stored. Each line in the file contains information on a product. This information is distributed in 6 fields separated by “|”. Here is an example of two products:

1234321|Notebook|TravelMate 2420|1235.50|Acer|15072006

7890987|Notebook|Qosmio G25-AV513|2120.75|Toshiba|01122006

The methods of the WareHouse class should be used to:

            - (C) save all information back in the “products.txt” file

- (D) add a new product in the warehouse

            - (E) cancel a product given with its code

            - (F) display all products with their information in alphabetical order

            - (G) find all the products manufactured by a specified manufacturer and having the price between two limits: minPrice and maxPrice

            - (H) display all expired products in a given date

            - (I) display the cheapest manufacturer for a product category given with its name.

(J) Organize the Product class of product instances in the most useful way you consider. (K) Don’t forget to provide the class with a constructor: Product(BufferedReader br).

 

Program Evaluation (weights in points)

A

B

C

D

E

F

G

H

I

J

K

Programming excellence

Total

5

5

10

10

10

15

5

5

5

15

15

20

120

 

Programming excellence: Java syntax and semantics, general organization of the program, and data/behaviour incapsulation