Initialized all classes.
Completed Tile.cs Completed TilePattern.cs Completed CalcPiecesPerHour method in Company.cs
This commit is contained in:
parent
343d21afc8
commit
e6b4276661
3 changed files with 124 additions and 4 deletions
|
|
@ -5,5 +5,62 @@
|
|||
/// </summary>
|
||||
public sealed class Tile
|
||||
{
|
||||
// TODO
|
||||
private readonly TileStyle _style;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
public readonly int Area;
|
||||
|
||||
public Tile(TileStyle style, int width, int height)
|
||||
{
|
||||
_style = style;
|
||||
_width = width;
|
||||
_height = height;
|
||||
Area = width * height;
|
||||
}
|
||||
|
||||
public decimal CalcProductionCost()
|
||||
{
|
||||
decimal pricePerCm = 0.016M;
|
||||
|
||||
decimal sizeFactor = 1;
|
||||
switch (Area)
|
||||
{
|
||||
case < 100:
|
||||
sizeFactor = 1.5M;
|
||||
break;
|
||||
case < 400:
|
||||
sizeFactor = 1.2M;
|
||||
break;
|
||||
case > 2500:
|
||||
if (Area > 8100)
|
||||
{
|
||||
sizeFactor = 1.8M;
|
||||
break;
|
||||
}
|
||||
sizeFactor = 1.6M;
|
||||
break;
|
||||
}
|
||||
|
||||
decimal styleFactor = 1;
|
||||
switch (_style)
|
||||
{
|
||||
case TileStyle.Raw:
|
||||
styleFactor = 0.8M;
|
||||
break;
|
||||
case TileStyle.FancyColor:
|
||||
styleFactor = 1.1M;
|
||||
break;
|
||||
case TileStyle.SimplePattern:
|
||||
styleFactor = 1.25M;
|
||||
break;
|
||||
case TileStyle.Ornate:
|
||||
styleFactor= 2.3M;
|
||||
break;
|
||||
}
|
||||
|
||||
decimal areaInCm = Area / 100M;
|
||||
decimal cost = areaInCm * pricePerCm * sizeFactor * styleFactor;
|
||||
|
||||
return cost;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue