Assignment 1: Wind Speed Processor
A device that connected to wind station constantly sends data on wind details (like wind speed, day and direction) that is stored in a log file (text file).
The data send is 16 bits in the following format:
Direction 4 bits (1 North, 2 North West, 3 West, 4 South West, 5 South, 6 South East, 7 East, 8 North East) (0001 to 1000)
Day 4 bits (1 Sunday, 2 Monday 7 Saturday) (0001 to 0111)
Wind Speed 8 bits (max 11111111 = 255 mph)
Direction first 4 bits; 0010 ->2 ->North West
Day second four bits; 0001 ->1 ->Sunday
Speed last eight bits; 00101011 ->43 mph
You are required to write a C++ program that read the data from the log file. Split the direction, day and wind speed covert and store them in an array. Calculate and display the min wind speed (with day and direction), max wind speed (with day and direction) and the average wind speed.
Your program must do the following:
1. Define a structure DATA with member direction, day and speed.
2. Declare an array of DATA structure.
3. Read all the data from the file as string, split and store them in the DATA structure array.
4. Process the array to calculate and display the min, max and average values of the wind speed.