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
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