Python Programming Assignment
Due: Start of Class Thursday, 28 February 2019
In this comprehensive programming assignment, you will combine the various components of the Python programming language that you learned this semester. The program processes observations of weather data in csv format, described by the following:
The program will process the csv data by creating a station based on its unique code, location, city and state, including a list of observation objects for that station. An observation has private instance fields for the non-repeated items in the field descriptions (full, month, week of, year, average, direction, maximum, minimum, precipitation, and speed) along with a reference to the station for which it is an observation. Note that the provided UML class specification shown on the next page is using Java to more clearly illustrate the interface of the classes but you must write the program in Python.
The weathertester.py file MUST incorporate the following components:
Prompt the user for a filename, incorporating exception handling until the user enters a valid file
Process the file (hint: use csv.DictReader() by creating stations and observations as specified above, maintaining 2 dictionaries:
o code_station_dict: associating the unique station Code to its correspond station object
o date_observation_dict: associating a date in Full format to a list of observation objects on that date OUTPUT> The number of keys in each dictionary.
Create a dictionary stations_by_state that associates the 2 char state abbreviation with the stations at that state location
OUTPUT> In alpha order, display the state abbreviation, the number of stations in that state, and an alphabetical listing of the city location of the station.
Using the date_observation_dict:
OUTPUT> In reverse chronological order (most recent date first), display the date followed by the count of the number of observations on that date and then display the highest and lowest temperature readings for that date,
including the station code and location associated with that temperature. Note that there may be more than one station reporting the highest and lowest temperatures.
ACO 240 Spring 2019 1 Python Programming Assignment
File
Overview
NOTE
station.py
class
implements toString as __repr__ in Python
observation.py
class
implements toString as __repr__ in Python
weathertester.py
main
On the due date, you will turn in the following:
1. A printout of a document that indicates the status of the implementation that you submitted for assessment along with
a statement signed verifying that you followed the academic integrity policy.
2. A printout of your .py files (must have name as comment).
3. A printout of the execution of your program in Python IDLE Shell (choose the AZ file).
4. An electronic copy of your zipped .py files must be turned in through the assignment facility.
REMINDER: THIS IS AN INDIVIDUAL ASSIGNMENT!
Only programs that successfully execute will be considered for assessment.
Incremental Development Suggestions:
Work on the implementation of each checkbox, saving a working version for each incorporated
checkbox so that you can earn partial credit if you do not get ALL checkboxes implemented.
Station
private String code
private String location
private String city
private String state
private String locationCity
private String locationState
private List
public Station(String c, String l, String ct, String st) public addObservation(Observation o)
public String toString() using __repr__ in Python
7 getter methods: 1 for each private instance variable
private Station station private String full
private int month
private int weekOf
private int year
private int average
private int direction
private int maximum private int minimum
private double precipitation private double speed
Observation
public Observation(Station s, String full, int mon, int wk, int yr, int avg, int dr, int mx, int mn,
double prec, double sp) public String toString using __repr__ in Python
11 getter methods: 1 tor each private instance variable
ACO 240 Spring 2019 2 Python Programming Assignment
File Summary
Reviews
There are no reviews yet.