Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Svetlina_Lab
- {
- public class Figure
- {
- private int scale;
- public Figure(int scale)
- {
- this.Scale = scale;
- }
- public int Scale { get; set; }
- private void DrawUpper()
- {
- int height = this.Scale;
- char bckgrndHyphen = '-';
- int bckgrndHyphenStartNum = 3 * this.Scale;
- char axeSymbol = '*';
- int axeNum = 1;
- char innerSymbol = '-';
- int innerNum = 0;
- int bckgrndHyphenEndNum = this.Scale * 2 - 2;
- for (int i = 1; i <= height; i++)
- {
- Console.WriteLine("{0}{1}{2}{1}{3}", new string(bckgrndHyphen, bckgrndHyphenStartNum), new string(axeSymbol, axeNum), new string(innerSymbol, innerNum), new string(bckgrndHyphen, bckgrndHyphenEndNum));
- innerNum++;
- bckgrndHyphenEndNum--;
- }
- }
- private void DrawHandle()
- {
- int handleHeight = this.Scale / 2;
- char handleSymbol = '*';
- int handleSymbolNum = 3 * this.Scale;
- char axeSymbol = '*';
- int axeSymbolNum = 1;
- char inner = '-';
- int innerNum = this.Scale - 1;
- for(int i = 1; i <= handleHeight; i++)
- {
- Console.WriteLine("{0}{1}{2}{1}{2}", new string(handleSymbol, handleSymbolNum), new string(axeSymbol, axeSymbolNum), new string(inner, innerNum));
- }
- }
- private void DrawLower()
- {
- int lowerHeight = this.Scale / 2;
- char bckgrndSymbol = '-';
- int bckgrndNum = this.Scale * 3;
- char axeSymbol = '*';
- int axeNum = 1;
- char inner = '-';
- int innerNum = this.Scale - 1;
- char endSymbol = '-';
- int endNum = this.Scale - 1;
- for (int i = 1; i <= lowerHeight; i++)
- {
- if(i < lowerHeight)
- {
- Console.WriteLine("{0}{1}{2}{1}{3}", new string(bckgrndSymbol, bckgrndNum), new string(axeSymbol, axeNum), new string(inner, innerNum), new string(endSymbol, endNum));
- bckgrndNum--;
- innerNum += 2;
- endNum--;
- }
- else
- {
- int width = this.Scale * 5;
- int axeSymbolNum = (width - ((bckgrndNum - 1) + endNum)) - 1;
- Console.WriteLine("{0}{1}{2}", new string(bckgrndSymbol, bckgrndNum), new string(axeSymbol, axeSymbolNum), new string(endSymbol, endNum));
- }
- }
- }
- public void DrawFigure()
- {
- DrawUpper();
- DrawHandle();
- DrawLower();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement