OnlineSupermarket.Receipt.cs
(完整代码) 883Busing System.Collections.Generic;
using System.Linq;
namespace OnlineSupermarket
{
public sealed partial class OnlineSupermarket
{
public record Receipt(IReadOnlyDictionary<GoodsInfo, int> GoodsInfoAndWeights)
{
public decimal TotalPrice => this.GoodsInfoAndWeights.Sum(
(infoAndWeight) => infoAndWeight.Value * infoAndWeight.Key.Price);
public decimal FreightAndPackingFee
{
get
{
var totalWeight = this.GoodsInfoAndWeights.Sum(
(infoAndCount) => infoAndCount.Value);
return totalWeight switch {
< 5 => 6.5m,
>= 5 and < 20 => 13m,
_ => 13m + totalWeight * .2m
};
}
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。