[SOLVED] OOP Homework 2

25.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

– Let, = ( , ) and = ( , ) be two points. Overload the following operators according to their definitions given:
Operator Type Expression Expression output
+ Binary + A new point = ( , ) where
= + and = + . This
operation represents a translation of the point by the amount specified by
* Binary ∗
where is a real number A new point = ( , ) where = ∗
and = ∗ . This operation represents a scaling of the point by the amount . The scaling is done with respect to the origin (0,0).
== Binary == TRUE (Boolean) if both points have same coordinates; otherwise FALSE
!= Binary ! = TRUE (Boolean) if the points are different; otherwise FALSE

-Let, and be two circles having centers and and radiuses and . Overload the following operators according to their definitions given:
Operator Type Expression Expression output
+ Binary + where is a 2D point. A new circle whose center is translated by the amount specified by the point . This operation represents a translation of the circle with respect to the origin (0,0).
* Binary ∗
where is a real number A new circle whose radius and center is scaled by the amount . This operation represents a scaling operation for the circle with respect to the origin (0,0).
+ binary + A new circle whose center is the
weighted average ∗ + ∗ (1 − ) and radius is + .
where = /( + )
– Binary − A new circle whose center is the
weighted average ∗ + ∗ (1 − ) and radius is − .
where = /( + )
== Binary == TRUE (Boolean) if both circles are of equal area; otherwise FALSE
> Binary > TRUE (Boolean) if the area of is larger than the area of ; otherwise FALSE
>= Binary >= TRUE (Boolean) if the area of is larger than or equal to the area of ; otherwise FALSE
< Binary < TRUE (Boolean) if the area of is smaller than the area of ; otherwise FALSE
<= Binary <= TRUE (Boolean) if the area of is smaller than or equal to the area of ; otherwise FALSE
++ Unary + +
+ + Increments of radius of by 1 unit. Should support both prefix and postfix version.

-Let, and be rectangles. Overload the following operators according to their definitions given:
Operator Type Expression Expression output
+ Binary + where is a 2D point. A new rectangle translated by point . This operation represents a translation of the rectangle with respect to the origin (0,0).
* Binary ∗
where is a real number A new rectangle whose points are scaled by the amount . This operation represents a scaling operation for the rectangle with respect to the origin (0,0).

-Create suitable examples to demonstrate all functionalities as specified in the cpp file.
More practice: [For online]
-Extend your program to include facilities for other geometric objects such as square, triangle, ellipse, etc.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.