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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started