日期:2014-05-17 浏览次数:20837 次
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请依次按提示输入:");
Console.WriteLine("输入购买金额:");
var inputMoney = double.Parse(Console.ReadLine());
Console.WriteLine("输入购买数量:");
var inputNumbers = int.Parse(Console.ReadLine());
Console.WriteLine("@输入是否是会员: 0:非会员; 1:银卡会员; 2:金卡会员;");
var inputVip = int.Parse(Console.ReadLine());
var Person1 = new CashContext(inputMoney, inputNumbers,inputVip);
Console.ReadLine();
}
}
//现金收取父类
internal abstract class CashReap
{
public abstract double AcceptCash(double money);
}
//正常收费子类
internal class CashNormal : CashReap
{
public override double AcceptCash(double money)
{
return money;
}
}
//打折子类
internal class CashDiscount : CashReap
{
private double _moneyDiscount = 1d;
public int ProductNumbers { get; set; }
public CashDiscount(double moneyDiscount)
{
_moneyDiscount = moneyDiscount;
}
public override double AcceptCash(double money)
{
return money*_moneyDiscount;
}
}
//返现子类
internal class CashRebate : CashReap
{
private double _moneyCondition = 0.0d;
private double _moneyReturn = 0.0d;
public CashR