You are on page 1of 3

Advanced Object Oriented Programming Assignment # 1

Reg. # _______________Section ________ Name _________________________

Department: Computer Engineering Program: B.S (CE)

Assignment 1
CE-206 Advanced Object Oriented Programming

Announced date: 18-08-2020 Due Date: 25-08-2020 Total Marks = 15


Marks Obtained =
Teacher Name:(Assistant Professor) Engr. Umm-e-Laila (Course coordinator)
(Assistant Professor) Engr. Aneeta Siddiqui

Sr. No Course Learning Outcomes PLOs Blooms


Taxonomy
CLO_1 Develop an understanding of object-oriented design artifacts and PLO_1 C2
their mapping to object-oriented programming. Engineering (Understanding)
Knowledge:
Question # 1 : WAP that creates MyPoint Class having the following specification.

i.e
a) Add the following methods in the above class
public void movePoint(int x, int y); // resetting x,y values w r t current values
public void changePoint(int x, int y);// resetting x,y values
public booleanequals(MyPoint p);
b) Add two constructors – one taking an x and y as parameters, the other setting the values
to 0.
c) Add a method that calculates and returns a MyPoint object that is exactly half-way
between the two points, i.e.,
MyPoint p1 = new MyPoint(0, 0);
MyPoint p2 = new MyPoint(4, 4);
MyPoint p3 = p1.findMidpoint(p2);
Advanced Object Oriented Programming Assignment # 1

Question # 2 :
a) Using MyPoint class. create a class that can
store circles, where each circle has an origin and a
radius.
b) Write methods to calculate the circumference
and area of a circle.
c) Write a method to determine whether two circles
intersect and a method to determine if two circles are
identical.

Question # 3:
The Polar Coordinate System is a two-dimensional coordinate system in which each
point on a plane is determined by a distance from a fixed point and an angle from a
fixed direction.
a) Design a class, PolarPointthat stores a fixed origin Point (that is shared by
all instances of the PolarPointclass and is initialed using Point origin
= new Point(0,0);) and a distance and angle from the reference point.
You can assume that the angle is always relative to an infinite line extending to
the right of the point (see diagram).

b) Converting between polar and cartesian coordinate systems can be done using
the sine and cosine operations.
x = r cos !+ xorigin
y = r sin !+ yorigin
c) Write a method that returns a Point in the cartesian coordinate system. You
may find the Math.cos(double a) and Math.sin(double a) methodsuseful.
I. Cartesian coordinates can be converted back to polar coordinates using

Write a constructor method that creates a PolarPoint object from a Point


object. For this question you may need to use the Math.sqrt(double a)
and Math.atan2(double y, double x) methods.
Advanced Object Oriented Programming Assignment # 1

II. Write a function that calculates the shortest straight-line distance between two
PolarPoint objects (Hint: This may be easier using the cartesian coordinate
system).

Question # 4: Create Class Hierarchy of the Following Diagram

Question #5:WAP that create a class for representing a complex variable consisting the
following information
1. Two instance hidden variable real and imaginary.
2. Two constructor’s i.e 1 default and other 2 augmented constructor.
3. Two get methods for accessing the values of instance variable.
4. Add methods that returns (object) the addition of two complex object.
5. Add methods that returns (object) the subtraction of two complex object.
6. Add methods that returns (object) the multiply of two complex object.

You might also like