By Thanos Stantzouris
Choose your prefered Language: greek_flag uk_flag

One production unit manufactures a product. The daily production quantity of the product in pieces, the date in DDMM format (DD = day MM = month), as well as the daily demand for this product from the 10 different distribution points available in the production unit are in a serial file orders.txt. For each different date, there is only one record in the file, that is, each line of the file is only one day, and the file is not calendared.

Example: (d. 26/03, production quantity 2000, daily demand, the remaining prices)

2603 2000

50 100 240 80 350 90 100 70 200 320


Write a class named alfa that will handle the data from the orders.txt file. The data will be serially read from the file (checking for the existence of the file is required). Private members - class data are:

    1. The month code, values 1-12

    2. The distribution point code, values int 1-10

    3. The total monthly demand for the product from this distribution point

The class must contain:

   A constructor for rendering zero values to its members.

   A constructor for assigning values to class objects by reading (accessing) a file.

In the main() function, specify an object array of the alpha class of N = 120 positions and initialize all the positions of the table using the appropriate constructor, setting all data members to their zero value.

Then by accessing the file:

   1. Enter values ​​in the array of objects using the appropriate constructor. Prices will be entered in ascending order of the distribution point and in ascending order of the month number, i.e. first of all the monthly totals for the distribution point 1, then all the monthly totals for the distribution point 2 and so on. (Note: use a 12x10 int table)

   2. Enter in a dynamic array, from each record of the file, price couples that include the month number and the residual or surplus daily production quantity (ie the difference in total daily demand from the daily production quantity).

(eg For the first record of the file, the dynamic table will include the pair: {3,400})

(400 = 2000 - Σxι = 2000 - 1600 ), where xι equals each position of the array.

   3. Using all items in the alpha class array, find and display the total annual product demand from each of the 10 distribution points.

   4. Using all the elements of the dynamic array, find and display, how many days each of the 12 months production are deficient and how many days are redundant.