Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

3. Existing organizations and programs constrain behavior.

Answered: 1 week ago