Question: [Object Oriented Question] Consider a simplified program, where we can ONLY draw circles and rectangles on the canvas. Choose one of these languages: C++/C#/Java, and

[Object Oriented Question]

Consider a simplified program, where we can ONLY draw circles and rectangles on the canvas. Choose one of these languages: C++/C#/Java, and write down some pseudo-codes (i.e. doesnt need to be grammatically accurate) for the following questions.

A) Define two classes for a Circle and a Rectangle. For both classes, we would also like to know where the center of the circle/rectangle is, and get the area of the circle/rectangle.

B) Obviously, these two classes share some common characteristics. Define a Shape class that encapsulates these common characteristics. What is the name of the relationship between the Rectangle/Circle class and Shape class, and what do you need to change about your codes in Q1? Also, why do we want/need the shape class at all?

C) Should you be able to draw an unspecified Shape on the canvas? Or does it have to be a rectangular or circle? What does this mean about the Shape class? Hint: abstract

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!