Language:EN
Pages: 8
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
and pursue academic dishonestly vigorously

And pursue academic dishonestly vigorously

ASSIGNMENT 4

DEPARTMENT AND COURSE NUMBER: COMP 1012

Material Covered:

•2D Arrays & Plotting
•Objects
•Recursion (Bonus marks)

•Assignments must follow the programming standards document published on the course website on UM Learn.

•Submit one .py file per question. Name the files using your name, the assignment number, and the question number, exactly as in this example: LastnameFirstnameA4Q2.py. Use your name exactly as shown in UM Learn (without hyphens, if applicable).

The date and time of the last file submitted controls the mark for the entire assignment.

•These assignments are your chance to learn the material for the exams. Code your assignments independently. We use software to compare all submitted assignments to each other, and pursue academic dishonestly vigorously. You must complete the Honesty Declaration before you will be able to submit your assignment.

DEPARTMENT AND COURSE NUMBER: COMP 1012

Since a real data set often has some incorrect data and the occasional field missing, a cleaned up catalogue has been prepared for your use in this assignment. The file stars.txt contains one line for each star that is represented in the catalogue. The meaning of each field (column) is described below.

•The sixth field is the Harvard Revised number, another identifier.

•The seventh field exists only for a small number of stars and is a semicolon-separated list of names for a star. A star may have several names, or no common names and simply be known by its catalogue numbers.

2

ASSIGNMENT 4

Create a plot displaying all of the stars that met the magnitude criteria in step 2. Import matplotlib.pyplot, for example:

import matplotlib.pyplot as plt

Step 4: Plot a constellation

Prompt the user to enter the name of a file containing a constellation. (Several have been provided in the Assignment 4 folder.)

ASSIGNMENT 4
DEPARTMENT AND COURSE NUMBER: COMP 1012

Your final plot should look similar to the plot below.

ASSIGNMENT 4

DEPARTMENT AND COURSE NUMBER: COMP 1012

that when you run into a bug, you should know exactly which method is causing the problem. When

writing longer methods, test those as they are developed, so that, for example, you know that the

•The Lake class should have the following methods:
oa constructor that, given a lake name and rating, will create a Lake object. oa method to print the object, in a readable format that includes all of the information that you have on the lake, including its name, water quality rating, and list of neighbouring lakes. Example: “Crabclaw has excellent water quality, and is connected to: Manomin, Upper Stewart”
oa method that will return the lake name.

oa method that will return the lake water quality.

•The Portage class should have the following methods:
oa constructor that, given references to two Lake objects and a distance, will create a Portage object.

oa method to print the object, in a readable format that includes all of the information that you have on the portage, including the names of the lakes it connects and its distance. Example: “Manomin and Crabclaw are connected by a portage of 0.6 km.”
oa method that will return the portage distance.

Load Data From Files [7 marks]:

•Your mainline should begin by loading the lake data into a list of Lake objects. oAsk the user to enter the name of a file containing lake data.

oRead the file one line at a time. For each line:
▪Identify the lake names and distance. Each line consists of two lake names, and a distance, with commas between the three. You can assume that each line in the file contains 3 pieces of information. However, you should verify that you actually have Lake objects with the provided names before creating a Portage object. If you do not have a Lake object for one or both of the lake names, do not create a Portage object, and print an error message instead.

▪Create a Portage object from the data on the line. Remember that the Portage object has references to two Lakes, not simply the lake names.

Interactive Behaviour [9 marks + up to 5 bonus marks]:

•After loading data from files, the program will ask the user what they want to do, over and over, until the user decides to quit.

oDetermine whether there is a portage between those two lakes, and print a message with the result. (As stated above, there should not be a list of all portages in the park. You need to get the portage information through the list of Lakes.)

6

oNote: This problem is more difficult than anything you will be expected to do on a quiz, test, or exam in this course. As a bonus problem, you need to design the recursive function (and any helper functions) yourself.

Sample program output:
Note that this is generated with a smaller dataset than is provided for your testing.

Please enter an option (q to quit, d for portage distance, e to test for existence of portage, r to find route: e
7

ASSIGNMENT 4
DEPARTMENT AND COURSE NUMBER: COMP 1012

[Programming Standards are worth 8 marks]

8

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Mogu

PageId: DOC0CEE8CA