By DePaul Dimadis
Choose your prefered Language: greek_flag uk_flag

A wind park consists of 20 identical wind turbines with codes 1-20. Each wind turbine includes 10 main subsystems (eg anemometer, flap, shell, etc.) with codes 1-10. The malfunction.txt serial file contains information about the times when a wind turbine is shut down due to a failure in one of its main subsystems for the same year. Consider that any such failure is due, in the first instance, to only one of these subsystems. There may be more than one fault each day from the same subsystem, for the same or for different wind turbines. Each line of the file concerns only one day and includes:
(a) the date in HHMM format, int type (HH = day, MM = month)
(b) the number of failures detected in all wind turbines (int type) with a maximum of 20.
(c) in the form of three-digit numerals, type int: the subsystem code, the wind turbine code and the corresponding time when the wind turbine was shut down (in minutes, int type number). (Obviously the maximum number of triads is 20.)
The file is not calendared and each date only exists once in the archive. B.C. (parentheses are not in the file and listed for your convenience).
1405, 6, (9, 7, 50), (2, 11, 40), (7, 13, 60), (2, 7, 30), (2, 11, 30), (7, 10, 60)
2706, 3, (3, 14, 15), (9, 18, 110), (2, 8, 17)
1102, 4, (1, 10, 45), (6, 15, 20), (6, 11, 77) (5, 13, 34)
Write a class named damage that will handle the data from the malfunction.txt file. Private members - class data are:
1. The date in HHMM format, int type number
2. The number of different subsystems that caused damage (maximum number = 10)
3. In the form of int type triplets, sorted by serial number of the subsystem:
  a. the subsystem code,
  b. the number of different wind turbines in which damage occurred; and
  c. the corresponding daily total off time (in minutes, int type number).
EXAMPLE: The 1st object of the damage class for the first line of the file will be as follows:
1405  3   2, 2, 100    7, 2, 120    9, 1, 50
The class must contain:
a) A constructor for yielding zero values ​​to members of its objects
b) A constructor for assigning values ​​from file reading. The data will be serially read from the file (checking for the existence of the file is required).
In the main () function, declare an object class of the damage class with NN locations (NN = known) and initialize all the locations in the table using the appropriate constructor, setting as default null values ​​for all data members. The NN value can be smaller, greater than or equal to the number of records in the malfunction.txt file.
Then access the malfunction.txt file:
1. Enter values ​​in table objects using the appropriate constructor.
2. Enter in a dynamic table, from each record of the file, pairs including the serial number of the wind turbine and the off-time (eg for the 1st record of the file, the dynamic table will include the pairs: , 50), (11, 40), (13, 60), (7,30), (11,30), (10,60)).
3. Find (if any) the number of lines from the file that are not included in the object table.

4. Using all objects in the damage class object table:
Find and display the total time that wind turbines were shut down due to failure of each subsystem, for each of the 12 months of the year, ie a total of 10 x 12 = 120 values.
5. Using all the dynamic table elements to find and display the total off-time of each machine tool (UNITS 1.0)
6. Create a descending class named new_damage, which will include as additional private members the corresponding int reputation data due to the failures of the subsystems for each date (eg for the 1st object of the damage class with data :
1405   3    2, 2, 100    7, 2, 120     9, 1, 50
there will have to be as new data three integers corresponding to the costs for subsystems 2, 7 and 9)
a. Write the constructor function to insert the data into an object of the resulting class new_damage.
b. Define a table of objects of the class new_damage, size NN = known.

c. Using the resulting class constructor, copy in this new table the data from the damage class of the damage class you created in query 1 by creating randomly valid sums for the new members - data at each position in the new table.
(NOTE: as many functions - members of the damage classes.)