A menu-driven program is required by a stationery company for the running of its stock control system. Each item of stock held will have:
· a stock code (1 letter + 5 digits);
· a stock description (in text form);
· a current level;
· a reorder level;
· a price (per unit of that stock item).
Assume a maximum of **twenty** items. The options available on the menu are shown below.
1. Initialise/extend stock.
2. Process a stock delivery.
3. Process a sale.
4. Display a list of items at or below reorder level.
5. Display an item's current level and reorder level.
At the end of the day (when the 'Quit' option is selected), the following statistics should be displayed:
· the total number of orders;
· the total value of those orders;
· the number of stock items at or below reorder level.
**Notes on Options (using the above menu numbers)**
1. This option will be used both to accept an initial list of stock items and to accept further items. In each case, ensure that the number of items does not exceed the maximum possible number.
2. For simplicity's sake, each delivery will be for one item only The user will enter the appropriate stock code and the quantity of the item that is being received. The item's current level will then be updated. Ensure that negative values are not accepted.
3. Again assume that only one stock item can be involved (though the order may be for several/many of this item). If there is enough stock, then reduce the current level for that item appropriately and display the total value of the order. If there is insufficient stock to satisfy the order, do not try to part-satisfy the order, but display a message about the inadequate stock level.
4. [No particular points.]
5. Accept an item's stock code and then display the two required fields.
**1. ** For options 2,3 and 5, display an error message if the user enters an invalid stock code (i.e., a code that doesn't exist) and re-prompt the user for a code until a valid code is entered. Also display an error message if an invalid option is selected.
**2. ** There is no need to check for a code being in the correct format or for any other validation that has not been specified explicitly.
**3. ** It should be obvious that several arrays will be required for this algorithm. Since all/most of the subsequent program will require access to these, you may make these global, but **list these variables, with their names and a brief statement of purpose for each, before your design**. You may also choose to make another variable global. If so, **make sure that you list this as well**.
**4. ** Remember to keep a count of the number of items of stock (i.e., the number of distinct codes) at all times.
5. Avoid duplication of codes.
For the above specification, I have attached a pseudocode program from which you can start building the Java program.
Using this pseudocode design as your starting point, implement the stock control program described in the specification above, but modify the algorithm in the ways described below.
i. Instead of accepting the initial data from the keyboard (as shown in line 5 of the pseudocode), read it from a text file into the appropriate arrays. The text file should have the name *[url removed, login to view]* and should contain the details of **17** items of stock, **at least 2** of which should be below reorder level and **1** just on reorder level. Use a separate method to read in the data.
ii. If your program cannot find the above file, it should display the message 'No data file found.' and then continue execution. Otherwise, as the data is read in, your program should display it in a table with suitable column headings.
iii. After the display of the statistics (at the end of the program), the data from the arrays should be displayed in tabular format once again and then written back to the text file.
1. In order to determine whether the data file exists, you will need to make use of the *File* class's *exists* method.
2. You will find it convenient to use *TextPad* to set up the initial data file, as you did in Practical 18.
3. For option 3, order values should be displayed to **2 decimal places**.
With this, I will also be attaching a full working program of the specifications above, and another java file which is not fully working. So basically I need you to use the full working program which is called ***Stationary,*** this file will be placed inside the folder called *nazam*, and complete the other program off which is called ***javaAssignment***.
Both programs need to look different, and please make javaAssignment very easy to understand with little description after each coding.
Thank you very much
jcreator. win XP