static void Manza() { Console.WriteLine("Manza Specification"); Console.WriteLine("===="); Console.WriteLine("Price: 7Lakh"); Console.WriteLine("Mileage : 15km/Litre"); Console.WriteLine("Type : Diesel"); Console.WriteLine("Do you want to exit : (Yes / No)"); string choice = Console.ReadLine(); if (choice == "Yes") { Environment.Exit(1); } if (choice == "No") { TwoFourwheeler o = new TwoFourwheeler(); o.Car(); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Menu"); Console.WriteLine("===="); Console.WriteLine("1.Car"); Console.WriteLine("2.Bike"); Console.WriteLine("3.Exit"); Console.WriteLine("Enter your choice"); int list = int.Parse(Console.ReadLine()); switch (list) { case 1: TwoFourwheeler o = new TwoFourwheeler(); o.Car(); break; case 2: TwoFourwheeler o1 = new TwoFourwheeler(); o1.Bike(); break; case 3: TwoFourwheeler o2 = new TwoFourwheeler(); o2.Exit(); break; default: break; } Console.ReadLine(); }