using System.Collections.
Generic;
using System.Collections.ObjectModel;
namespace Project_1
{
class Line
{
private string _ProductSKU;
public string ProductSKU
{
get { return _ProductSKU; }
}
private string _Description;
public string Description
{
get { return _Description; }
}
private Stock _Stock;
public Stock Stock
{
get { return _Stock; }
}
private Line(string sku, string description)
{
_ProductSKU = sku;
_Description = description;
}
private static List<Line> _SaleLines = new List<Line>();
public static ReadOnlyCollection<Line> SaleLines
{
get { return _SaleLines.AsReadOnly(); }
}
public static Line SKU(string sku)
{
Line result = null;
foreach (Line l in _SaleLines)
{
if (l.ProductSKU == sku)
{
result = l;
break;
}
}
return result;
}
public static bool CreateDiscreteLine(string sku, string description,
double weightPerItem)
{
if (SKU(sku) != null)
return false;
Line line = new Line(sku, description);
line._Stock = new DiscreteStock(line, weightPerItem);
_SaleLines.Add(line);
return true;
}
public static bool CreateWeighedLine(string sku, string description,
double defaultSize)
{
if (SKU(sku) != null)
return false;
Line line = new Line(sku, description);
line._Stock = new WeighedStock(line, defaultSize);
_SaleLines.Add(line);
return line != null;
}
public bool Purchase(StockQuantity quantity, out Item items)
{
return _Stock.Purchase(quantity, out items);
}
public override string ToString()
{
return string.Format("{0} - {1,-40} Stock: {2}", _ProductSKU,
_Description, _Stock);
}
}
}
abstract class StockQuantity
class DiscreteStockQuantity: StockQuantity
public Quantity(int x)
class VolumeStockQuantity:StockQuantity
Quantity(double x)
}
class Item
int quantity;
string description;
double weight;
public item(int x)
qunatity=x;
public item(string x)
description=x;
public item(double x)
weight=x;
public override void display()
Console.writeline("item x= +x");
console.writeline("int x= qunatity");
console.writeline("double x=weight");
console.writeline("string =description");
}
}
class receipt
{int list;
public GETTEXT()
abstract class stock
int line;
public abstract void adjuststock(stockquantity quantity);
public abstract bool purchase(stockqunatity quantity, out item item);
public abstract void restock();
class discretestock:stock
int stored stock;
intshelfstock;
double weightperitem;
class weighedstock:stock
double storedstock;
double shelfstock;
doube defaultpurchase;
}
}