Question
Design and then write an Object Oriented program in C++ using CodeBlocks that meets the specifications shown below. You should provide a suitable menu with
Design and then write an Object Oriented program in C++ using CodeBlocks that meets the specifications shown below. You should provide a suitable menu with an exit option in your main program. Do not use GUI interaction. CANNOT USE STL data structures .
The program will read only one data input file. After loading the data into the required data structures, the program displays the menu to the user. The required data structures (see below) must be used for menu 1 to 4. The design must be modular to cater for future iterations of requirements. CANNOT have data structure classes that do I/O. Read csv file, put into object and put into a Vector (NOT STL)
Class & Variables
-
date (class with 3 variables - day,month, year)
-
time (class with 2 variables - minute, hour)
-
float wSpeed (under class weather)
-
float temperature (under class weather)
-
float solarRadiation (under class weather)
Menu option are:
- The average wind speed and average ambient air temperature for a specified month and year (print on screen only).
Example output format if there is data:
January 1905: 5.5 km/h, 25.5 degrees C
Example output format if there is no data:
March 1905: No data
- Average wind speed and average ambient air temperature for each month of a speficied year(print on screen only).
Example output format if there is data:
1905
January: 5.5 km/h, 25.5 degrees C
Feburary: 4.5km/h, 27.5 degrees C
March: No data
- Total solar radiation in kWh/m2 for each month of a specified year.(print on screen only)
Example output format if there is data:
1905
January: 196.4 kWh/m2
Feburary: 200.3 kWh/m2
March: No data
- Average wind speed (km/h), average ambient air temperature and total solar radiation in kWh/m2 for each month of a specified year. (print to a file called WindTempSolar.csv)
Output Format:
Year
Month, Average Wind Speed, Average Ambient Temperature, Solar Radiation
Example output format:
1905
January, 5.5, 25.5, 196.4
Feburary, 4.5, 27.5, 200.3
Year is printed on the first line and the subsequent lines list the month and the average wind speed, average ambient air temperature and the total solar radiation for each month. The values are comma separated.
For menu item 4: if data is not available for any month, do not output the month. In the example, March 1905 has no data. Nothing is output for March. If the entire years data is not available, output just the year on the first line and the message No Data on the second line.
- Exit the program.
The user specifies the month and/or year. Your program asks for these on the command line and the user types in the required values and presses the Enter key. Date and month entries on the command line must be numeric. For example, the user types in the value 1 and not string January or Jan to represent first month of the year.
[Data Structure] - Do not have data structure classes that do I/O.
Vector Class
A template vector class, called Vector must be used and you must write your own minimal and complete template Vector class to store data in a linear structure. A Vector class is a dynamic array encapsulated in a class called Vector. Access to the private array is through the Vectors public methods. The Vector for the assignment provides the same functionality as the array with controlled access. The Vector should allow for resizing. If more space is needed in the Vector than what is available, the Vetor would increase it size. Note: Not STL vector
Date Class
Create a new class call Date. Date will contain the date stored as day of the month, month and the year. Provide appropriate set and get methods for the class.The first field in the data file contains both the date and time. Need to split the date and time values and stored the date in the Date class
Time Class
Need to split the date and time values from csv data file. You need to create and unit test a Time class to store time values.
Data Sample - Although there a number of data columns in the data file, you will only use columns with labels WAST (date and time), S(Wind Speed), SR (Solar Radiation) and T (Ambient air temperature).
WAST,DP,Dta,Dts,EV,QFE,QFF,QNH,RF,RH,S,SR,ST1,ST2,ST3,ST4,Sx,T 31/03/2016 9:00,14.6,175,17,0,1013.4,1016.9,1017,0,68.2,6,512,22.7,24.1,25.5,26.1,8,20.74 31/03/2016 9:10,14.6,194,22,0.1,1013.4,1016.9,1017,0,67.2,5,565,22.7,24.1,25.5,26.1,8,20.97 31/03/2016 9:20,14.8,198,30,0.1,1013.4,1016.9,1017,0,68.2,5,574,22.7,24,25.5,26.1,8,20.92 31/03/2016 9:30,15.1,215,27,0,1013.4,1016.8,1017,0,66.6,5,623,22.6,24,25.5,26.1,8,21.63
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started