[Solved] COMP1012 Assignment2

$25

File Name: COMP1012_Assignment2.zip
File Size: 188.4 KB

SKU: [Solved] COMP1012 Assignment2 Category: Tag:
5/5 - (1 vote)

You dont need to use input() to get started on this assignment. Use the values shown in the sample sessions to get your solution started, then add input later.

Many of the calculations require you to convert units (from millimeters to meters, from millimeters to inches, from hours to minutes to seconds). Make sure that youre converting the values before doing the calculation!

Use 2 decimal places of precision for speed and 4 decimal places of precision for all other values in your output.

Do not create your own value for . Use the constant that comes from the math module.

Programmed by

Use the following code snippet at the end of your script to print out the time and end of processing message:

Question 1: Required

In this question, you will calculate some statistics for a csv file named reducedweather.csv. The file contains tabular data which includes Manitoba daily minimum and maximum temperatures from Jan until Sept 17 in 2019. The first row is a header record (row), with headings Max Temp and Min Temp. After the header row, each row is a day where maximum and minimum temperature for that day is recorded. From this file, you need to calculate mean, standard deviation, highest and lowest temperature for each column.

The description for this problem is exactly same as the assignment 1 question 1. But here you need to use functions for reading the file, finding standard deviation, squared difference, max and mean value.

What to do

Create a module with name StatisticsCalculation. To create the module, you can open a new python script. Save the script with the given name. The statistics calculation module contains following functions: calculateMean(data):

The parameter data is a list of floating point values. Calculate and return the mean. Remember, data is a single list, it does not contain any nested list. calculateStdDev(data, mean):

Given a list of data and the mean of the data, calculate and return the standard deviation. Again remember, data is a single list, it does not contain any nested list. mean is a float value. findMin(data):

Given a list of data, it will return the min. Data is a single list, it does not contain any nested list. You can not use any built in function to calculate the minimum value. In this function, you need to implement your own min function. findMax(data, mean):

Given a list of data, it will return the max. Data is a single list, it does not contain any nested list. You can not use any built in function to calculate the maximum value. In this function, you need to implement your own max function.

Create another module with name InputOutputHandler. This module contains the following functions: printCSVResults(headings,means, stdDevs, mins, maxs):

The parameters headings, means, stdDevs, mins and maxs are lists containing the column headers and statistics from the csv file. You need to print the statistics from this function.

readCSVFile(fileName):

The parameter fileName is a string. Open the file and read the header row and data from the csv

file. Return the header and data. This should be able to read any number of columns from the csv file.

main():

Create a main function module and from the main function call these functions to find the statistics. In your main function, there can be several lists to for storing returned minimums, maximums, standard deviations. To call the functions of StatisticsCalculation module, you need to import the module. You may call the functions in any order but the result should be exactly similar to assignment 1 question 1.

Data source: http://climate.weather.gc.ca/climate_data/daily_data_e.html?StationID=27174

Sample output:

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COMP1012 Assignment2
$25