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) Now, the user wants to draw something on the canvas. There are many ways to do this. Consider this method: we have a Canvas class, with a draw function. The user decides upon the shape first, then clicks on the canvas, and the draw function is called, and the shape shows up on the canvas. Write the sketch codes for the Canvas class, and the draw function in this scenario.

B) Whats the relationship between Canvas and Shape: association, aggregation, composition, inheritance? Compare to the relationship between Shape and Style, what are the differences, if there are any? Explain what happen to the shapes when you delete a canvas, and what happen to the styles when you delete a shape.

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!