Objective: We want to construct the cities graph and connect cities using shortest roads between them. For example, if there are 4 cities, (co, c1, c2, and c3) then we will make a road between co and the one which has minimum distance to co, and so on.
Sample code: Sample code, sample output and instruction are given below. You must write the required functions (read below) to achieve the objective.
Details: We have a class Graphxy, which has 5 private data fields, namely x, y, n, s, and t. This class is used to construct graph for cities. We construct cities graph by passing the list of x-axis and y-axis for each city (see initializer function). Data fields are:
x stores the x-coordinates of cities
y stores the y-coordinates of cities
n stores number of cities on the graph
s is the screen object for that graph
t is the turtle object for that graph
The class has 4 methods, namely init() initializer function, printpoints(), distances(), and makeroads(), and two other functions (not part of the class). Initializer function makes the graph by taking the list of x-points and y-points, printpoints() makes a graph using turtle and prints the cities at their (x,y) coordinates, the function distances() should calculate distance between all cities (If there are 7 cities, then it will return 7x7 matrix), and makeroads() will connect cities with shortest roads between them.
class Graphxy:
def init (self, xlist = None, ylist = None):
def printpoints (self):
def finddistances (self):
def makeroads (self, d, m):
It essentially creates an object of class GraphXY using xpoints and ypoints. It is shown below with example results.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme