Saint Mary’s University
Department of Mathematics and Computing Science
CSC 341.1: Data Structures and Software Engineering I
FALL 1998-99
Assignment #1
Instructor: Dr. Pawan Lingras
Due Date: September 23,1998
Create a class called CartesianPoint that has two data members called x and y.
- Write a constructor, which accepts the values of x, and y, use default values of zero. Overload input, output, assignment, comparison (== and !=), and minus operators.
- The minus (-) operator accepts two variables of CartesianPoint type and returns the distance between these points.
- The minus operator also throws an exception (Note: it is not an error) called ZeroDistance if the distance between two points is zero.
- The exception ZeroDistance also contains a variable of the type CartesianPoint as a public data member.
Write a test program to test all of the features of CartesianPoint type.