Write a module called point

Assignment Help Computer Engineering
Reference no: EM132206567

Write a module called point. The module's code is intended to represent and manipulate points in 2-dimensional space. An important part of writing this module is deciding how to represent a point. If you pick an appropriate representation, then the functions listed below will each be just one or two lines of code.

a) make_point is passed 2 parameters, x and y (representing the x and y co-ordinates of a point). It is up to you to decide what this function should return. Here is an example call. It creates a point whose x co-ordinate is 1 and whose y co-ordinate is 4.

>>> p1 = point.make_point(1,4)

b) getxy is passed one parameter, a point p. It returns a tuple of length 2, representing the x and y co-ordinates of p. Continuing with the above example:

>>> point.getxy(p1) (1, 4)

c) move_point is passed three parameters: a point p, an integer dx, and an integer dy. It changes the x and y co-ordinates of the point p by adding dx to p's x co-ordinate, and dy to p's y coordinate. It returns nothing. For example, continuing with the above code:

>>> point.move_point(p1, 2, 1) \

>>> point.getxy(p1) (3, 5)

d) distance is passed 2 parameters p1 and p2, both of which are points. It returns the distance between p1 and p2. Continuing on with the previous examples:

>>> p2 = point.make_point(4, 6)

>>> point.distance(p1, p2)

1.4142135623730951

>>> point.move_point(p2, 3,2)

>>> point.distance(p1, p2)

Reference no: EM132206567

Questions Cloud

Write an overview about the armsim simulator : Write an overview about the ARMSIM simulator (features, requirements, functionalities...etc)
Written communication skills for most jobs : Oral skills are more important than written communication skills for most jobs.
Three different approaches to omni retailing : Three Different Approaches to Omni Retailing: The Nordstrom Approach, The Macy's Approach, The Rent the Runway Approach:
What kind of analysis might the board undertake : Raze the building and sell the site and all or part of the surroundingplaying fields as building lots (from 6 to 12 lots, depending on howmuch land is sold).
Write a module called point : Write a module called point. The module's code is intended to represent and manipulate points in 2-dimensional space
How would you communicate the value of diversity : Communicating the value of diversity in the workplace. How would you communicate the value of diversity?
Challenges of future ftth access networks : Discuss requirements and challenges of future FTTH access networks - Discuss promising future techniques for FTTH access networks
Predict the effect of the supreme court ruling on the price : The North Carolina State Board of Dental Examiners had been requiring that only licensed dentists be allowed to sell teeth-whitening services.
What is the utility level achieved by any consumer : Write down the production side equilibrium conditions for the model and use these plus the demands to solve for the general equilibrium in Autarky?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd