用C#语言完成以下控制台程序代码

用C#语言完成以下控制台程序代码

求以下问题的完整代码,C#语言,面向对象,继承控制台程序

img

using System;
namespace ConsoleApp2
{
    class Vehicle
    {
        public int wheels { get; set; }
        public double weight { get; set; }
        public Vehicle(int wheels, double weight)
        {
            this.wheels = wheels;
            this.weight = weight;
        }
        public void Properties()
        {
            Console.WriteLine($"车轮个数:{wheels}\t车重:{weight}");
        }
    }
    class Car : Vehicle
    {
        public int loader { get; set; }
        public Car(int wheels, double weight, int loader) : base(wheels, weight)
        {
            this.loader = loader;
        }
        public new void Properties()
        {
            Console.WriteLine($"车轮个数:{wheels}\t车重:{weight}吨\t承载人数:{loader}");
        }
    }
    class Truck : Car
    {
        public double payload { get; set; }
        public Truck(int wheels, double weight, int loader,double payload) : base(wheels, weight,loader)
        {
            this.payload = payload;
        }
        public new void Properties()
        {
            Console.WriteLine($"车轮个数:{wheels}\t车重:{weight}吨\t承载人数:{loader}\t承载重量:{payload}吨");
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            var truck = new Truck (16,10,6,30);
            truck.Properties();
            Console.ReadKey();
        }
    }
}
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632