Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C# Create a Picture derived class of the Shape class. A picture contains an array of shapes, which may themselves be pictures or any

In C#

Create a Picture derived class of the Shape class. A picture contains an array of shapes, which may themselves be pictures or any other shapes. Implement the Draw, Move, and ToString methods for pictures. Implement an Add method that will add shapes to the picture. The center of a shape will be the center of the picture. When drawing a picture, draw its shapes relative to the center of the picture. For example, if a picture has center (100,100) and contains a circle with center (20,30) and radius 10, then draw that circle at center (120,130) with radius 10.

Your console output should look something like the below:image text in transcribed

Use this code to test your program:

public class Ex10_17 : Form

{

Shape s0 = new Line(10, 10, 20, 30);

Shape s1 = new Circle(new Point(50, 50), 30);

Shape s2 = new Circle(new Point(150, 150), 30);

Picture p1 = new Picture(new Point(20, 40), 80, 80);

Picture p2 = new Picture(new Point(120, 50), 200, 200);

Shape t0 = new Line(10, 10, 20, 30);

Shape t1 = new Circle(new Point(50, 50), 30);

Picture p3 = new Picture(new Point(20, 40), 80, 80);

public Ex10_17()

{

Size = new Size(700, 620);

p1.Add(s0);

p1.Add(s1);

p2.Add(p1);

p2.Add(s2);

p2.Move(20, 50);

p3.Add(t0);

p3.Add(t1);

Console.WriteLine(p2);

}

}

Picture at center {X-140,Y-100 Pisture at center {X-20,Y-40 Line from (X-10,Y-10 to (X-2e, Y-30 Circle at (x-se,Y-se with radius 30 ircle at {X=150,Y=150) with radius 30 Picture at center {X-140,Y-100 Pisture at center {X-20,Y-40 Line from (X-10,Y-10 to (X-2e, Y-30 Circle at (x-se,Y-se with radius 30 ircle at {X=150,Y=150) with radius 30

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_2

Step: 3

blur-text-image_3

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

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

=+ Who do you think is right? Why?

Answered: 1 week ago