银行收银系统(C#)

思路:  分三大块    一部分是显示出来的商品   一部分是用来存储商品的仓库  一部分是销售商品的 平台     仓库是分门别类的放置商品的  应该先给仓库添加货架using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Thr
摘要由CSDN通过智能技术生成


思路:  分三大块    一部分是显示出来的商品   一部分是用来存储商品的仓库  一部分是销售商品的 平台     仓库是分门别类的放置商品的  应该先给仓库添加货架


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 收银系统
{
    class Acer : ProductFather
    {
        public Acer(String name,decimal price,  string id) : base(name,price,id)
        {


        }
    }
}

----------------------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 收银系统
{
    class Banana:ProductFather
    {
        public Banana(String name, decimal price,  string id) : base(name, price,  id)
        {

        }
    }
}

------------------------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 收银系统
{
    /// <summary>
    /// 折扣
    /// </summary>
   abstract  class Discount
    {
        /// <summary>
        /// 折扣的抽象函数
        /// </summary>
        /// <param name="money">本应该付多少钱</param>
        /// <returns>返回打折后应付的钱</returns>
        public abstract decimal DiscountMethod(decimal money);
    }
}
--------------------------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 收银系统
{
    /// <summary>
    ///按打折率打折的类,继承打折类
    /// </summary>
    class discountRate : Discount
    {
        //用自动属性存储打折率
        public double Rate
        {
            get;
            set;
        }
        //把打折率通过构造函数传进来
        public discountRate(double rate)
        {
            this.Rate = rate;
        }

        /// <summary>
        /// 重写打折的构造函数
        /// </summary>
        /// <param name="money">打折之前应该付多少钱</param>
        /// <returns>返回打折后应付的钱</returns>
        public override decimal DiscountMethod(decimal money)
        {
            return money * (decimal)this.Rate;
        }


    }
}
---------------------------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tas

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值