Truck.cs类
//卡车类 public class Truck : Vehicle1 { //重载 public int Load { get; set; } //构造函数 public Truck(string color, double dailyrent, string licenseNO, string name, int rentDate, string rentUser, int yearsOfService, int load) :base(color, dailyrent, licenseNO, name, rentDate, rentUser, yearsOfService) { this.Load = load; } //计算价格 public override double CalcPrice() { double Price = 0; Price = this.DailyRent * this.RentDate; return Price; } } }
Vehicle1.cs类
//交通工具类 public abstract class Vehicle1 { //颜色 public string Color { get; set; } //日租金 public double DailyRent { get; set; } //车牌号 public string LicenseNO { get; set; } //车的名称 public string Name { get; set; } //时间 public int RentDate { get; set; } //使用人 public string RentUser { get; set; } //使用天数 public int YearsOfService { get; set; } //构造函数 public Vehicle1(string color, double dailyrent, string licenseNO, string name, int rentDate, string rentUser,