Provide an ADT specification for a point in a two dimensional space. By definition, to create such a point, you need to provide two coordinates. Supplement your ADT with adequately chosen query functions.


Difficulty level
This exercise is mostly suitable for students
Type 		Point2D

Parameter 	

Use 		real

Operations
	Point2D : real x real  -->	Point2D
	x_coordinate : Point2D -->	real
	y_coordinate : Point2D -->	real

Constructors
	Point2D

Preconditions
	No preconditions

Axioms
	Let a,b be 2 reals
	* x_coordinate(Point2D(a,b))=a
	* y_coordinate(Point2D(a,b))=b

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Sort an array of strings