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.

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

List six habits that can help you become a more positive thinker.

Answered: 1 week ago

Question

What information remains to be obtained?

Answered: 1 week ago

Question

How reliable is this existing information?

Answered: 1 week ago

Question

How appropriate would it be to conduct additional research?

Answered: 1 week ago