Object Passing Lab
Object Passing Lab
Note:
Add copy constructor and equals method in all questions.
1. Create an encapsulated class Rectangle with length and width as data members. Create
a. Default constructor
b. One- argument constructor
c. two- argument constructor
d. display ()
e. calculateArea ()
f. checkSquare()
g. CompareArea(?) //compares two objects and returns the object with larger area.
2. Create an encapsulated class Point class with x and y as data members. Create
a. Default constructor
b. One- argument constructor (for x)
c. two- argument constructor
d. display()
e. move()
f. checkOrigin()
g. AddTwoPoints(Point pa)// Creates and returns a new point from two other
points
h. AddThreePoints( ???)
Methods:
a. Default constructor
b. two- argument constructor
c. Create a method compareAuthors that compares the author of two Books and
returns true if both books have same author and false otherwise. (This method
Must manipulate two Book objects)