C# Program of Displaying Different Vehicle Information

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

namespace ConsoleApplication19
{
    class Information
    {
        string name;
        string location;
        int model;
        int speed;
        int weight;

        public Information(string name, string location)
        {
            this.name = name;
            this.location = location;
            Console.WriteLine("Bicycle Information");
            Console.WriteLine("Name : " + name);
            Console.WriteLine("Location : " + location);
        }
        public Information(string name, int model, int speed)
        {
            this.name = name;
            this.model = model;
            this.speed = speed;
            Console.WriteLine("Car Information");
            Console.WriteLine("Name : " + name);
            Console.WriteLine("Model : " + model);
            Console.WriteLine("Speed : " + speed);
        }
        public Information(string name,int model,int weight,int speed)
        {
            this.name = name;
            this.model = model;
            this.weight = weight;
            Console.WriteLine("Lorry Information");
            Console.WriteLine("Name : " + name);
            Console.WriteLine("Model : " + model);
            Console.WriteLine("Weight : "+weight);
            Console.WriteLine("Speed : "+speed);
        }

        static void Main(string[] args)
        {
            Console.WriteLine("==============");
            Information bicycle = new Information("Honda", "USA");
            Console.WriteLine("\n==============");
            Information car =new Information("Mercedes",7550,1550 );
            Console.WriteLine("\n==============");
            Information lorry = new Information("HYUNDAI", 2017, 20000,550);
            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment