You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
890 B

3 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Builder
{
/*Concrete Builder*/
public class Simons : IBedBuilder
{
private Bed _bed = new Bed();
private int pillowSize = 0;
private string sheetName;
public Bed Build()
{
_bed.Pillow = $"Pillow Size#{pillowSize}";
_bed.Sheet = $"Sheet {sheetName}";
return _bed;
}
public IBedBuilder MakeFrame()
{
_bed.Frame = (DateTime.Now.Month > 5 && DateTime.Now.Month < 9) ?
"Simons Summer Frame" :
"Simons Wood Frame";
return this;
}
public IBedBuilder MakeMattress()
{
_bed.Mattress = "Simons Mattress";
return this;
}
public IBedBuilder MakePillow(int size)
{
pillowSize = size;
return this;
}
public IBedBuilder MakeSheet(string sheet)
{
sheetName = sheet;
return this;
}
}
}