Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write C + + program Based on the lengthy description provided, here s a breakdown of what you should do and the classes you need

Write C++ program
Based on the lengthy description provided, heres a breakdown of what you should do and the classes you need to create for your C++ program, along with their requirements. This setup is intended for managing and processing weather station data, specifically focusing on wind speed:
1. Objective:
Your primary task is to write a C++ program that reads weather data from a CSV file, computes the average wind speed and its standard deviation, and identifies entries in the data that match the computed average wind speed. The data structure used for managing this data will be essential for handling and processing the information efficiently.
2. Classes and Data Structures:
Required Classes:
Date Class: This class should already exist from a previous lab. It is used to manage date values extracted from the data file.
Time Class: This needs to be created. It should store and manage time values.
Vector Template Class: This class represents a dynamic array capable of storing any data type. For this specific task, it will store instances of WindRecType.
WindRecType Struct:
This is a struct, but you should consider whether a class might be more appropriate depending on the complexity of operations and encapsulation required. For simple data storage, a struct is adequate.
Fields:
Date d; - Date of the data entry.
Time t; - Time of the data entry.
float speed; - Wind speed in meters per second.
Vector Realization:
WindlogType: This is a typedef definition for Vector. It will be the primary data structure for storing wind records.
3. Functionality Requirements:
Reading Data: Your program must be able to read data from a CSV file, parse it, and populate instances of WindRecType which are then stored in WindlogType.
Data Processing:
Calculate the average wind speed (in km/h) and the sample standard deviation of the wind speeds.
Identify and print the date and time for entries that match the computed average wind speed. Note that matching floating point numbers requires consideration of precision, so a tolerance level should be set for what constitutes a match.
Handling Different Data Formats:
The program should be robust against changes in the order of columns in the CSV file. The identification of columns should be based on headers rather than fixed positions.
Error Handling:
Handle potential erroneous or missing data (e.g.,"N/A" values for offline sensors) gracefully. These should not be included in the calculations for average or standard deviation.
Debugging and Validation:
Before loading the entire dataset, test the reading and parsing functions with a small subset of data to ensure correctness.
Output the parsed data to another CSV file (testoutput.csv) and manually verify this output by comparing it to the source file in a spreadsheet or text editor.
4. Implementation Considerations:
Consider the use of classes versus structs. For simple containers that just hold data without requiring methods or encapsulation, structs are adequate. If more functionality or encapsulation is needed, use classes.
Ensure your classes are designed with high cohesion and low coupling, focusing on making them reusable and maintainable.
5. Testing and Validation:
Test the program's output against manual calculations (like using spreadsheet formulas) to ensure the calculations for average and standard deviation are correct.
Use comprehensive debugging to confirm the data is read and stored correctly before moving on to the calculation phase.
Below are my Date class
lass Date
{
public:
/**
* @brief Default constructor initializes a new Date object.
* Constructs a Date with all components set to their default values.
*/
Date();
/**
* @brief Construct a new Date object with specified day, month, and year.
* @param day Day of the month.
* @param month Name of the month.
* @param year Year component.
*/
Date( unsigned day, const string& month, unsigned year );
/**
* @brief Retrieves the day of the month.
* @return Day as an unsigned integer.
*/
unsigned GetDay() const;
/**
* @brief Sets the day of the month.
* @param day Day of the month to be set.
*/
void SetDay( unsigned day);
/**
* @brief Retrieves the name of the month.
* @param month Reference to a string to store the retrieved month.
*/
void GetMonth(string &month) const;
/**
* @brief Sets the name of the month.
* @param month String representing the new month.
*/
void SetMonth(const string &month);
/**
* @brief Retrieves the year component.
* @return Year as an unsigned integer.
*/
unsigned GetYear() const;
/**
* @brief Sets the year component.
* @param year Year to be set.
*/
void SetYear( unsigned year);
private:
int m_day;
string m_month;
int m_year;
};

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

Factor by grouping. 12 - 6q - 18p + 9pq

Answered: 1 week ago