static void Main(string[] args)
        {
            Motorway motorway = new Motorway("Avenue");

            Console.WriteLine("full name of Motorway is: {0}", motorway.Fullname);

            Motorway m1 = new Motorway("Street", true);

            Console.WriteLine("fullname of motorway and wheather toll or not: {0},{1}", m1.Fullname, m1.Toll);

            Motorway m2 = new Motorway("Road", 8);

            Console.WriteLine("fullname of motorway and no of lanes is: {0},{1}  ", m2.Fullname, m2.Numberoflanes);


            Motorway m3 = new Motorway();

            m3.Direction = "N";
            m3.Lane      = 8;
            m3.Surface   = "concrete";
            m3.IsToll    = false;
            m3.Name      = "Lane";
            m3.party     = "Govt";
            Console.WriteLine(m3.ToString());
        }
Пример #2
0
        static void Main(string[] args)
        {
            Motorway myMotorway = new Motorway();

            Console.Write("Enter the name of the motorway: ");
            string myName = Console.ReadLine();

            myMotorway.Name = myName;
            Console.Write("Enter the type of motorway: ");
            string myType = Console.ReadLine();

            myMotorway.Type = myType;
            Console.Write("Enter the direction: ");
            string myDirection = Console.ReadLine();

            myMotorway.Direction = myDirection;
            Console.Write("Enter the surface type: ");
            string mySurface = Console.ReadLine();

            myMotorway.Surface = mySurface;
            Console.Write("Enter number of lanes: ");
            int myLanes = Convert.ToInt32(Console.ReadLine());

            myMotorway.Lanes = myLanes;
            Console.Write("Toll or No Toll? ");
            string myToll = Console.ReadLine();

            myMotorway.Toll = myToll;
            Console.Write("Who maintains the motorway? ");
            string myMaint = Console.ReadLine();

            myMotorway.MantainingParty = myMaint;
            Console.WriteLine($"The name of the roadway is {myMotorway.Direction} {myMotorway.Name} {myMotorway.Type}");
            Console.WriteLine($"The name of the roadway is {myMotorway.Direction} {myMotorway.Name} {myMotorway.Type}, {myMotorway.Toll}");
            Console.WriteLine($"The name of the roadway is {myMotorway.Direction} {myMotorway.Name} {myMotorway.Type} with {myMotorway.Lanes} lanes");
            Console.WriteLine(myMotorway.ToString());
        }