Shapes (C# OOP Advanced - Polymorphism - Lab)
Някой има ли идея какво пропускам в условието, неясно е написано какво точно искат да прави методът Draw(), но все пак мисля, че няма значение как ще се имплементира:
80/100 и поне аз не виждам къде може да е грешката по така описаната задача:
Shape https://pastebin.com/WYdPCz35
Rectangle https://pastebin.com/UyeP1Zuc
Circle https://pastebin.com/qmUsWuYn
Program.cs https://pastebin.com/YD3Ggdv3
https://judge.softuni.org/Contests/Practice/Index/1503#2
3.Shapes
NOTE: You need a public StartUp class with the namespace Shapes.
Create a class hierarchy, starting with abstract class Shape:
- Abstract methods:
- CalculatePerimeter(): double
- CalculateArea(): double
- Virtual methods:
- Draw(): string
Extend the Shape class with two children:
- Rectangle
- Circle
Each of them needs to have:
- Fields:
- height and width for Rectangle
- radius for Circle
- Encapsulation for these fields
- A public constructor
- Concrete methods for calculations (perimeter and area)
- Override methods for drawing