-------------------------------------------------Vehicle类-------------------------------------------------
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace Qichechuzxt 8 { 9 public abstract class Vehicle 10 { 11 //颜色 12 public string Color { get; set; } 13 14 //日租金 15 public double DailyRent { get; set; } 16 17 //车牌号 18 public string LicenseNO { get; set; } 19 20 //车名称 21 public string Name { get; set; } 22 23 //时间 24 public int RentDate { get; set; } 25 26 //使用人 27 public string RentUser { get; set; } 28 29 //使用年限 30 public int YearsOfService { get; set; } 31 32 //构造函数 33 public Vehicle(string color, double dailyrent, string licenseNO, string name, int rentDate, string rentUser, int yearsOfService) 34 { 35 this.Color = color; 36 this.DailyRent = dailyrent; 37 this.LicenseNO = licenseNO; 38 this.Name = name; 39 this.RentDate = rentDate; 40 this.RentUser = rentUser; 41 this.YearsOfService = yearsOfService; 42 } 43 44 //方法重写 45 public Vehicle() { } 46 47 //执行 48 public abstract double CalcPrice(); 49 } 50 }