using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
MartiniGlass martiniGlass = new MartiniGlass();
martiniGlass.PrintGlass(4);
Console.ReadLine();
}
}
class MartiniGlass
{
private const char GlassTop = '0';
private const char GlassHandle = '|';
private const char GlassBottom = '=';
public void PrintGlass(int GlassSize)
{
int width = CalcGlassWidth(GlassSize);
PrintGlassTop(GlassSize, width);
PrintGlassHandle(GlassSize, GlassSize - 1);
PrintGlassBase(width);
}
private int CalcGlassWidth(int size)
{
int width = 1;
width += 2 * (size - 1);
return width;
}
private void PrintGlassTop(int size, int width)
{
for (int i = 0; i < size; i++)
{
PrintLineOfChars(i, ' ');
PrintLineOfChars(width, GlassTop);
width -= 2;
Console.WriteLine();
}
}
private void PrintGlassHandle(int size, int startPos)
{
for (int i = 0; i < size; i++)
{
PrintLineOfChars(startPos, ' ');
Console.WriteLine(GlassHandle);
}
}
private void PrintGlassBase(int width)
{
PrintLineOfChars(width, GlassBottom);
}
private void PrintLineOfChars(int amount, char symbol)
{
for (int i = 0; i < amount; i++)
Console.Write(symbol);
}
}
}