{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CSE202Lab10 - In your main function 1 Create 2 objects L1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE202 Lab 10 - Classes Define a Class named “LINE” to implement the concept of a line. Your class should have four private data members; x-coordinate & y coordinate of the first point and x- coordinate & y coordinate of the second point. Your class will also include the following public member functions: 1) A Default Constructor which initializes coordinates to 0, 0 for first point and 10, 10 for second point. 2) A Parameterized Constructor which initializes coordinates to values given by 4 parameters. 3) A complete Set of Accessor Functions for every data member. 4) Additional Methods to Print the distance of the line using the formulae distance = sqrt[(|x2 – x1|)^2 + (|y2 – x1|)^2] Print the coordinates of both the points of the line. Translating a line by taking 2 parameters xt & yt.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: In your main function, 1) Create 2 objects L1, L2 of this class 2) Let L1 call the default constructor while L2 call the parameterized constructor with values of your choice. 3) After that Print the coordinates of L1 & L2 using the print member function and also print the distances by calling the distance member function. 4) Finally Translate L2 with new translation values xt = 20, yt = 30 using the translate member function and print the new values of L2 using the print member function. Don’t forget to create 3 files where one file named “Line.h” will contain the Class Definition, the other file with the name “Line.cpp” will contain the Class Implementation and the third file named “Lab10.cpp” will contain the main function....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online