Advertisement
simonradev

Figure

Jun 30th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. namespace DrawingTool
  2. {
  3.     using System;
  4.  
  5.     public abstract class Figure
  6.     {
  7.         protected int firstSide;
  8.         protected int secondSide;
  9.  
  10.         public Figure(int firstSide)
  11.         {
  12.             this.firstSide = firstSide;
  13.             this.secondSide = firstSide;
  14.         }
  15.  
  16.         public void Draw()
  17.         {
  18.             string topAndBotRow = "|" + new string('-', this.firstSide) + "|";
  19.  
  20.             Console.WriteLine(topAndBotRow);
  21.             for (int row = 0; row < this.secondSide - 2; row++)
  22.             {
  23.                 Console.WriteLine("|" + new string(' ', this.firstSide) + "|");
  24.             }
  25.  
  26.             Console.WriteLine(topAndBotRow);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement