/// <summary> /// Class Name:Program /// Description:Class which containts Main Method. /// Author: /// Created On:18/5/2015 /// </summary> /// #region Main method Class static void Main(string[] args) { List <object> arrylist; List <object> objarrylist; ArrayList arraylist_objects; arrylist = new List <object>(); objarrylist = new List <object>(); arraylist_objects = new ArrayList(); try { #region Define objects //object creation ConstantMessage objconst; Program objprogram; Vowel objvowel; SwichVowel objswitchvowel; CaseCheck objcscheck; Reverse objreverse; Sort objsort; SearchArray search_arra; ReviseArray revise_arra; CopyArray objcopyarr; Power objpower; NotepadFile objfile; WindowDetails objwindetails; Customer objcustomer; Entity objentity; Franchisee objfranch; Bubble_Sort objbubblesort; Array_Transformation objarrtransform; DoubleToInt objdbint; Structure objstrct; Structure_Datesort objstructdatesort; objstructdatesort = new Structure_Datesort(); FileWrite objfilewrite; FileRead_Exception objfileread; objconst = new ConstantMessage(); StringBuilder_Str objstringbuilder; child objchild; Driver objdriver; Vehicle objvehicle; Car objcar; //Arraylist_objects objarylistobj; ArmoredVehicle objarmoredvehicle; IVehicle objinterfaceIvehicle; vehicle objinterfacevehicle; Car7_10 objcar7_10; IFuelConsumption objfuelinterfaceCar; IFuelConsumption objfuelinterfacearmored; Fuel7_11 objfuel; Hashtable_Sortedlist objhash; #endregion while (true) { //object #region Objects Initialization objprogram = new Program(); objvowel = new Vowel(); objswitchvowel = new SwichVowel(); objcscheck = new CaseCheck(); objreverse = new Reverse(); objsort = new Sort(); search_arra = new SearchArray(); revise_arra = new ReviseArray(); objcopyarr = new CopyArray(); objpower = new Power(); objfile = new NotepadFile(); objwindetails = new WindowDetails(); objcustomer = new Customer(); objentity = new Entity(); objfranch = new Franchisee(); objbubblesort = new Bubble_Sort(); objarrtransform = new Array_Transformation(); objdbint = new DoubleToInt(); objstrct = new Structure(); objfilewrite = new FileWrite(); objfileread = new FileRead_Exception(); objstringbuilder = new StringBuilder_Str(); objchild = new child(); objdriver = new Driver(); objvehicle = new Vehicle(); objcar = new Car(); objinterfaceIvehicle = new Car(); objinterfacevehicle = new ArmoredVehicle(); objarmoredvehicle = new ArmoredVehicle(); objfuelinterfaceCar = new Car(); objfuelinterfacearmored = new ArmoredVehicle(); objfuel = new Fuel7_11(); objhash = new Hashtable_Sortedlist(); #endregion //objarylistobj = new Arraylist_objects(); //Get the input from user AS Day.Exercise No. string a; Console.WriteLine(objconst.strExer); a = Console.ReadLine(); //Display the No. of Day string dy = a.Substring(0, 1); Console.WriteLine("Day=" + dy); int intDy = Convert.ToInt32(dy); //Display the No. of Exercise string ex = a.Substring(2); Console.WriteLine("Exercise No.=" + ex); int intEx = Convert.ToInt32(ex); if (intDy > 9 || intDy < 0) { Console.WriteLine(objconst.strday); } else if (intEx > 18) { Console.WriteLine(objconst.strExercise); } else { Console.WriteLine("Code for " + intDy + "." + intEx); Console.WriteLine("*************************************************"); //code for Day1 if (intDy == 1) { Console.WriteLine(objconst.ShowMessage1); objprogram.Exit(); } else { switch (a) { case "2.1": case "3.1": objvowel.FindVowel(); objprogram.Exit(); break; case "2.2": case "3.2": objswitchvowel.FindSwitchVowel(); objprogram.Exit(); break; case "2.3": case "3.3": objcscheck.CountChar(); objprogram.Exit(); break; case "2.4": case "3.4": objreverse.ArrayReverse(); objprogram.Exit(); break; case "2.5": case "3.5": objsort.ArraySort(); objprogram.Exit(); break; case "2.6": case "3.6": search_arra.SearchFunction(); objprogram.Exit(); break; case "2.7": case "3.7": revise_arra.CountFunction(); objprogram.Exit(); break; case "2.8": case "3.8": objcopyarr.ThreeArray(); objprogram.Exit(); break; case "2.9": case "3.9": objpower.FindPowerNum(); objprogram.Exit(); break; case "2.10": case "3.10": objfile.OpenFile(); objprogram.Exit(); break; case "2.11": case "3.11": objwindetails.GetDetails(); objprogram.Exit(); break; case "4.1": case "5.1": case "6.1": case "4.2": case "5.2": case "6.2": Console.WriteLine(objconst.strCustomerMethod); objcustomer.Load(); objcustomer.Save(); objcustomer.Validate(); objprogram.Exit(); break; case "4.3": case "5.3": case "6.3": Console.WriteLine(objconst.strEntityProp); Console.WriteLine(objentity); objprogram.Exit(); break; case "4.4": case "5.4": case "6.4": Console.WriteLine(objconst.strchildclass); objprogram.Exit(); break; case "4.5": case "5.5": case "6.5": case "4.6": case "5.6": case "6.6": objfranch.GetFees(); Console.WriteLine(objfranch); objprogram.Exit(); break; case "4.7": case "5.7": case "6.7": case "4.8": case "5.8": case "6.8": Console.WriteLine(objconst.strcustomernum); int num_customer1 = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < num_customer1; i++) { Console.WriteLine(objconst.strcustomerno); objentity.Property_Method_Entity(); arraylist_objects.Add(objentity); } Console.WriteLine(objconst.strfranchcount); int num_franch1 = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < num_franch1; i++) { objfranch.GetFees(); arraylist_objects.Add(objfranch); } foreach (object obj in arraylist_objects) { Console.WriteLine(obj); } objprogram.Exit(); break; case "4.9": case "5.9": case "6.9": Console.WriteLine(objconst.strcustomernum); int num_customer = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < num_customer; i++) { Console.WriteLine(objconst.strcustomerno); objcustomer.Property_Method(); arrylist.Add(objcustomer); } Console.WriteLine(objconst.strfranchcount); int num_franch = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < num_franch; i++) { objfranch.GetFees(); arrylist.Add(objfranch); } objprogram.Exit(); break; case "4.10": case "5.10": case "6.10": foreach (object obj in arrylist) { Console.WriteLine(obj); } objprogram.Exit(); break; case "4.11": case "5.11": case "6.11": objbubblesort.BubbleSort(); objprogram.Exit(); break; case "4.12": case "5.12": case "6.12": objarrtransform.Trasform(); objprogram.Exit(); break; case "4.13": case "5.13": case "6.13": objdbint.DataTypeConv(); objprogram.Exit(); break; case "4.14": case "5.14": case "6.14": Console.WriteLine(objconst.strstringbuilder); Console.WriteLine(objconst.strintnum); int inputNumber = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(objstringbuilder.NumbersToWords(inputNumber)); objprogram.Exit(); break; case "4.15": case "5.15": case "6.15": Console.WriteLine(objconst.strdatecount); int datecount = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < datecount; i++) { objstrct.GetDate(); } objprogram.Exit(); break; case "4.16": case "5.16": case "6.16": Console.WriteLine(objconst.strdatecount); int datecount_sort = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < datecount_sort; i++) { objstructdatesort.Getdate_Struct(); } Console.WriteLine(objconst.stractualdate); objstructdatesort.Print(); objprogram.Exit(); break; case "4.17": case "5.17": case "6.17": objfilewrite.WriteToFile(); objprogram.Exit(); break; case "4.18": case "5.18": case "6.18": objfileread.FileReadException(); objprogram.Exit(); break; //day 7,8 & 9 case "7.1": case "8.1": case "9.1": objdriver.Drive(); objprogram.Exit(); break; case "7.2": case "8.2": case "9.2": objchild.GetCarClass(); objprogram.Exit(); break; case "7.3": case "8.3": case "9.3": objcar.Drive72(); objprogram.Exit(); break; case "7.4": case "8.4": case "9.4": objvehicle.Drive(); //method of Vehicle class which contains in Vehicles namespace objcar.Drive72(); objprogram.Exit(); break; case "7.5": case "8.5": case "9.5": case "7.6": case "8.6": case "9.6": objinterfaceIvehicle.Destruct(); objinterfacevehicle.Destruct(); objprogram.Exit(); break; case "7.7": case "8.7": case "9.7": Console.WriteLine(objconst.strcountcarobj); int countcar = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(objconst.strcountarmoredobj); int countarmored = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < countcar; i++) { objinterfaceIvehicle.Destruct(); arrylist.Add(objinterfaceIvehicle); } for (int i = 0; i < countarmored; i++) { objinterfacevehicle.Destruct(); arrylist.Add(objinterfacevehicle); } foreach (object s in arrylist) { Console.WriteLine(s); } objprogram.Exit(); break; case "7.8": case "8.8": case "9.8": ArrayList arrylist1 = new ArrayList(); objinterfacevehicle.Destruct(); arrylist1.Add(objinterfacevehicle); foreach (object s in arrylist1) { Console.WriteLine(s); } objprogram.Exit(); break; case "7.9": case "8.9": case "9.9": Console.WriteLine(objconst.strcountcarobj); int countcarobj = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < countcarobj; i++) { arrylist = new List <object>(); objinterfaceIvehicle.Destruct(); } for (int i = 0; i < countcarobj; i++) { string strmodelname = objcar.ModelName; arrylist.Add(strmodelname); } foreach (object s in arrylist) { Console.WriteLine(s); } objprogram.Exit(); break; case "7.10": case "8.10": case "9.10": Console.WriteLine(objconst.strcountcarobj); int countcar7_10obj = Convert.ToInt32(Console.ReadLine()); string strcarmodelnm; arrylist = new List <object>(); for (int i = 0; i < countcar7_10obj; i++) { Console.WriteLine(objconst.strmodelnm); strcarmodelnm = Console.ReadLine(); objcar7_10 = new Car7_10(strcarmodelnm); string s1 = objcar7_10.ModelName; arrylist.Add(s1); } Console.WriteLine("******************"); foreach (object s in arrylist) { Console.WriteLine(s); } objprogram.Exit(); break; case "7.11": case "8.11": case "9.11": case "7.12": case "8.12": case "9.12": int kmcar, initfuelcar, effcar; //variasbles for car int kmarmored, effarmored, initfuelarmored; //variables for armored vehicle //For Car Console.WriteLine(objconst.strinitialfuelcar); initfuelcar = Convert.ToInt32(Console.ReadLine()); objcar = new Car(initfuelcar); Console.WriteLine(objconst.strincar + initfuelcar); kmcar = objfuelinterfaceCar.Drive7_11(); //For Armored Vehicle Console.WriteLine(objconst.strinitialfuelarmored); initfuelarmored = Convert.ToInt32(Console.ReadLine()); objarmoredvehicle = new ArmoredVehicle(initfuelarmored); Console.WriteLine(objconst.strinArm + objarmoredvehicle.InitialFuel); kmarmored = objfuelinterfacearmored.Drive7_11(); //Fuel Efficiency for car Console.WriteLine(objconst.strfueleffcar); effcar = Convert.ToInt32(Console.ReadLine()); objcar.FuelEfficiency = effcar; Console.WriteLine(objconst.streffcar + objcar.FuelEfficiency); //Fuel efficiency for armored Console.WriteLine(objconst.strfueleffarmored); effarmored = Convert.ToInt32(Console.ReadLine()); objarmoredvehicle.FuelEfficiency = effarmored; Console.WriteLine(objconst.streffArm + objarmoredvehicle.FuelEfficiency); int leftfuel_car = ((kmcar * initfuelcar) - (effcar)); if (leftfuel_car <= 0) { objfuel.NoFuelExe(); } else { Console.WriteLine(objconst.strleftcar + leftfuel_car); } int leftfuel_armored = ((kmarmored * initfuelarmored) - (effarmored)); if (leftfuel_armored <= 0) { objfuel.NoFuelExe(); } else { Console.WriteLine(objconst.strleftArm + leftfuel_armored); } objprogram.Exit(); break; case "7.13": case "8.13": case "9.13": objhash.GetobjectHashTable(); objprogram.Exit(); break; default: Console.WriteLine(objconst.ShowMessage1); objprogram.Exit(); break; } } } } } catch (Exception ex) { Console.WriteLine(ex.Message); Program objpr = new Program(); objpr.Exit(); } }
// NAME :- MAIN METHOD // AUTHOR NAME :- SHIKHA MALIK // DECRIPTION :- MAIN METHOD // CREATED DATE :- 16/07/2012 static void Main(string[] args) { string strS; Vowel objVowel; SwitchVowel objSvowel; CaseCheck objCaseCheck; Reverse objReverse; PowerNum objPowerNum; WindowName objWindowName; //Declaration of variable char chr = 'a'; int n, m; ArrayList arrLstN = new ArrayList(); List <object> arrLstlist = new List <object>(); StructDate[] objdt; ReverseSort objReverse1; SearchArray objSearchArray; ReviseArray objReviseArray; CopyArray objCopyArray; NotePadApplication objNotePadApplication; Franchisee objFranchisee; Customer objCustomer; BubbleSort objBubbleSort; TransformArry objTransformArry; CastValue objCastValue; StringBldr objStringBldr; StructDate objStructure; DateArray objDateArray; TextFile objTextFile; ReadTextFile objReadTextFile; ArrayList arrLstCarArmd = new ArrayList(); List <object> objListCar5 = new List <object>(); Driver objDriver; Car objCar; Car2 objCar2; Car3 objCar3; Car4 objCar4; ArmoredVehicle objArmoredVehicle; CarArmoredVcle objCarArmoredVcle; CarArmoredVcle1 objCarArmoredVcle1; Car5 objCar5; List <object> objArryLstD = new List <object>(); List <object> objArryLstD1 = new List <object>(); try { System.Console.WriteLine(Constant.strEntrP1); System.Console.WriteLine(Constant.strEntrP2); System.Console.WriteLine(Constant.strEntrP3); System.Console.WriteLine(Constant.strEntrP4); System.Console.WriteLine(Constant.strEntrP5); System.Console.WriteLine(Constant.strEntrP6); System.Console.WriteLine(Constant.strEntrP7); System.Console.WriteLine(Constant.strEntrP8); System.Console.WriteLine(Constant.strEntrP9); System.Console.WriteLine(Constant.strEntrP10); System.Console.WriteLine(Constant.strEntrP11); System.Console.WriteLine(Constant.strEntrP12); System.Console.WriteLine(Constant.strEntrP13); System.Console.WriteLine(Constant.strEntrP14); System.Console.WriteLine(Constant.strEntrP15); System.Console.WriteLine(Constant.strEntrP16); System.Console.WriteLine(Constant.strEntrP17); System.Console.WriteLine(Constant.strEntrP18); System.Console.WriteLine(Constant.strEntrP19); System.Console.WriteLine(Constant.strEntrP20); System.Console.WriteLine(Constant.strEntrP21); System.Console.WriteLine(Constant.strEntrP22); System.Console.WriteLine(Constant.strEntrP23); System.Console.WriteLine(Constant.strEntrP24); System.Console.WriteLine(Constant.strEntrP25); System.Console.WriteLine(Constant.strEntrP26); System.Console.WriteLine(Constant.strEntrP27); System.Console.WriteLine(Constant.strEntrP28); System.Console.WriteLine(Constant.strEntrP29); System.Console.WriteLine(Constant.strEntrP30); System.Console.WriteLine(Constant.strEntrP31); System.Console.WriteLine(Constant.strEntrP32); System.Console.WriteLine(Constant.strEntrP33); System.Console.WriteLine(Constant.strEntrP34); System.Console.WriteLine(Constant.strEntrP35); System.Console.WriteLine(Constant.strSpace); System.Console.WriteLine(Constant.strStar); do { System.Console.WriteLine(Constant.strEntrCh); //Gather Information regarding choice strS = System.Console.ReadLine(); //Read value of string switch (strS) { case "2.1": //case use for 2.1 exercise that is chracter is vowel or not objVowel = new Vowel(); //create object for class objVowel.vowelc(); break; case "2.2": //case use for 2.2 exercise that is chracter is vowel or not using swith case objSvowel = new SwitchVowel(); //create object for class objSvowel.Switchvl(); break; case "2.3": //case use for 2.3 exercise that is for Enter digit , char in both case and count their times. objCaseCheck = new CaseCheck(); //create object for class objCaseCheck.CaseC(); break; case "2.4": //case use for 2.4 exercise that is use for reverse array objReverse = new Reverse(); //create object for class objReverse.Rev(); break; case "2.5": // case use for 2.5 exercise that is use for reverse array and sort array objReverse1 = new ReverseSort(); //create object for class objReverse1.RevS(); break; case "2.6": // case use for 2.6 exercise that is use for search element from arry objSearchArray = new SearchArray(); //create object for class objSearchArray.Sarray(); break; case "2.7": // case use for 2.7 exercise that is use for serch element and print number of times its exists. objReviseArray = new ReviseArray(); //create object for class objReviseArray.Rarray(); break; case "2.8": // case use for 2.8 exercise that is use for copy array according to condition objCopyArray = new CopyArray(); //create object for class objCopyArray.Carray(); break; case "2.9": // case use for 2.9 exercise that is use for calculate the power of entered number objPowerNum = new PowerNum(); //create object for class objPowerNum.Pwrnum(); break; case "2.10": // case use for 2.10 exercise that is used for open notepad objNotePadApplication = new NotePadApplication(); //create object for class objNotePadApplication.Notepad(); break; case "2.11": // case use for 2.11 exercise that is used for display required system information objWindowName = new WindowName(); //create object for class objWindowName.WinName(); break; case "4.7": // case use for 4.7 exercise that is for arraylist Console.WriteLine(Constant.strEnumObjArry); //message for enter number of object of Customer class n = int.Parse(Console.ReadLine()); for (int i = 1; i <= n; i++) // loop for number of times of object of Customer class { objCustomer = new Customer(); Console.WriteLine(Constant.strEntrsalCt + "" + i); objCustomer.Salutation = Console.ReadLine(); Console.WriteLine(Constant.strEntrNmCt + "" + i); objCustomer.Name = Console.ReadLine(); Console.WriteLine(Constant.strEntrMatCt + "" + i); objCustomer.Maritial_Status = Console.ReadLine(); Console.WriteLine(Constant.strEntrGenCt + "" + i); objCustomer.Gender = Console.ReadLine(); Console.WriteLine(Constant.strEntrAddCt + "" + i); objCustomer.Address = Console.ReadLine(); Console.WriteLine(Constant.strEntrQualCt + "" + i); objCustomer.Qualification = Console.ReadLine(); Console.WriteLine(Constant.strEntrLanCt + "" + i); objCustomer.Language = Console.ReadLine(); arrLstN.Add(objCustomer); //add into arraylist } Console.WriteLine(Constant.strEntrObjFrch); // message for enter number of object of Franchisee class m = int.Parse(Console.ReadLine()); for (int i = 1; i <= m; i++) // loop for number of times of object of Franchisee class { objFranchisee = new Franchisee(); Console.WriteLine(Constant.strEntrFeesFrch + "" + i); objFranchisee.Fees = int.Parse(Console.ReadLine()); arrLstN.Add(objFranchisee); //add into arraylist } Console.ReadLine(); break; case "4.8": // case use for 4.8 exercise that is for show arraylist for (int i = 0; i < arrLstN.Count; i++) { Console.WriteLine(arrLstN[i].ToString()); } break; case "4.9": // case use for 4.9 exercise that is for Typed Arraylist Console.WriteLine(Constant.strEnumObjList); //message for enter number of object of Customer class n = int.Parse(Console.ReadLine()); for (int i = 1; i <= n; i++) // loop for number of times of object of Customer class { objCustomer = new Customer(); Console.WriteLine(Constant.strEntrsalCt + "" + i); objCustomer.Salutation = Console.ReadLine(); Console.WriteLine(Constant.strEntrNmCt + "" + i); objCustomer.Name = Console.ReadLine(); Console.WriteLine(Constant.strEntrMatCt + "" + i); objCustomer.Maritial_Status = Console.ReadLine(); Console.WriteLine(Constant.strEntrGenCt + "" + i); objCustomer.Gender = Console.ReadLine(); Console.WriteLine(Constant.strEntrAddCt + "" + i); objCustomer.Address = Console.ReadLine(); Console.WriteLine(Constant.strEntrQualCt + "" + i); objCustomer.Qualification = Console.ReadLine(); Console.WriteLine(Constant.strEntrLanCt + "" + i); objCustomer.Language = Console.ReadLine(); arrLstlist.Add(objCustomer); // add into List } Console.WriteLine(Constant.strEntrObjFrch); m = int.Parse(Console.ReadLine()); for (int i = 1; i <= m; i++) { objFranchisee = new Franchisee(); Console.WriteLine(Constant.strEntrFeesFrch + "" + i); objFranchisee.Fees = int.Parse(Console.ReadLine()); arrLstlist.Add(objFranchisee); // add into List } Console.ReadLine(); break; case "4.10": // case use for 4.10 exercise that is for show arraylist for (int i = 0; i < arrLstlist.Count; i++) { Console.WriteLine(arrLstlist[i].ToString()); } break; case "4.11": //case use for 4.11 exercise that is use for sorting array objBubbleSort = new BubbleSort(); //create object for class objBubbleSort.BublSrt(); break; case "4.12": //case use for 4.12 exercise that is used for transform matrix objTransformArry = new TransformArry(); //create object for class objTransformArry.TrnsfrmArr(); break; case "4.13": //case use for 4.13 exercise that is used for casting of double value objCastValue = new CastValue(); objCastValue.CastFltMy(); //create object for class break; case "4.14": //case use for 4.14 exercise that is used for convert input amount into string objStringBldr = new StringBldr(); Console.WriteLine(Constant.strEntrAmount); int intN = int.Parse(Console.ReadLine()); string strS2; strS2 = objStringBldr.NumToWrds(intN); //create object for class Console.WriteLine(strS2); break; case "4.15": //case use for 4.15 exercise that is used for create StructDate objStructure = new StructDate(); objStructure.dateArray(); // //create object for class break; case "4.16": //Case use for 4.16 exercise that is used for sorting date Console.WriteLine(Constant.strEnumDate); int size = Convert.ToInt32(Console.ReadLine()); objdt = new StructDate[size]; //create object of structDate array for (int i = 0; i < size; i++) { Console.WriteLine(Constant.strEntrdate + (i + 1)); Console.WriteLine(objdt[i].dateArray()); } objDateArray = new DateArray(); objDateArray.dateArray(objdt); //Pass by value objDateArray.dateArray(ref objdt); //Pass by Reference break break; case "4.17": //Case use for 4.17 exercise that is used for Write lines on file objTextFile = new TextFile(); //create object for class objTextFile.TextFileM(); break; case "4.18": //Case use for 4.18 exercise that is used for read file content objReadTextFile = new ReadTextFile(); //create object for class objReadTextFile.ReadText(); break; case "7.1": //Case use for 7.1 exercise that is used Driver class objDriver = new Driver(); objDriver.Drive(); //create object for class break; case "7.2": objCar = new Car(); //Case use for 7.2 exercise that is used Car class objCar.Drive(); break; case "7.3": //Case use for 7.3 exercise that is used Car2 class objCar2 = new Car2(); objCar2.Drive(); //create object for class break; case "7.4": //Case use for 7.4 exercise that is used Car3 class objCar3 = new Car3(); objCar3.Drive(); //create object for class break; case "7.5": //Case use for 7.5 exercise that is used Car4 class objCar4 = new Car4(); objCar4.Destruct(); //create object for class break; case "7.6": //Case use for 7.6 exercise that is used ArmoredVehicle class objArmoredVehicle = new ArmoredVehicle(); objArmoredVehicle.Destruct(); //create object for class break; case "7.7": //Case use for 7.7 exercise that is used CarArmoredVcle class objCarArmoredVcle = new CarArmoredVcle(); ArrayList objarr = objCarArmoredVcle.CarArmored(); //create object for class foreach (object obj in objarr) { Console.WriteLine(obj); } break; case "7.8": //Case use for 7.8 exercise that is used CCarArmoredVcle1 class objCarArmoredVcle1 = new CarArmoredVcle1(); ArrayList objarr1 = objCarArmoredVcle1.CarArmored(); //create object for class foreach (object obj in objarr1) { try { Console.WriteLine(obj); } catch (VehicleNtDestydException v) { Console.WriteLine(v.Message); } } break; case "7.9": //Case use for 7.9 exercise that is used Arraylist, create dynamically object Console.WriteLine(Constant.strEntrCarobject); int intLst1 = int.Parse(Console.ReadLine()); for (int i = 0; i < intLst1; i++) //Create object in looping { Console.WriteLine(Constant.strEntrCarModel); string strModelnm = Console.ReadLine(); objCar5 = new Car5(strModelnm); objArryLstD1.Add(objCar5); //Add object intito Arraylist } for (int i = 0; i < objArryLstD1.Count; i++) //looping for traverse list { Console.WriteLine(objArryLstD1[i].ToString()); } break; //objListCar5.Add(objCar5 = new Car5("IV-Tec")); //objListCar5.Add(objCar5 = new Car5("City Honda")); //foreach (object obj in objListCar5) //{ // Console.WriteLine(obj.ToString()); //} // break; case "7.10": //Case use for 7.10 exercise that is used Arraylist, create dynamically object and make readonly property Console.WriteLine(Constant.strEntrCarobject); int intLst = int.Parse(Console.ReadLine()); for (int i = 0; i < intLst; i++) //Create object in looping { Console.WriteLine(Constant.strEntrCarModel); string strModelnm = Console.ReadLine(); CarArmoredVclList objCarArmoredVclList = new CarArmoredVclList(strModelnm); objArryLstD.Add(objCarArmoredVclList); //Add object intito Arraylist } for (int i = 0; i < objArryLstD.Count; i++) //looping for traverse list { Console.WriteLine(objArryLstD[i].ToString()); } break; case "7.11": //Case use for 7.11 exercise that is used for fuel calculation Console.WriteLine(Constant.strIniValCar); //Enter initial value for car int intK = Convert.ToInt16(Console.ReadLine()); Car6 objCar6 = new Car6(intK); Console.WriteLine(Constant.strIniValArmored); //Enter initial value for Armored Vehicle int intC = Convert.ToInt16(Console.ReadLine()); CarFuelCmsptn objCarFuelCmsptn = new CarFuelCmsptn(intC); objCarFuelCmsptn.FuelEfficiency = 5; objCar6.FuelEfficiency = 14; Console.WriteLine(Constant.strEntrKiloCar); //Enter number of Kilometer Driven by Car by user try { objCar6.Drive(Convert.ToDouble(Console.ReadLine())); } catch (NoFuelLeftException v) { Console.WriteLine(v); } Console.WriteLine(Constant.strEntrKiloArmored); // Enter number of Kilometer Driven by ArmoredVehicle by user try { objCar6.Drive(Convert.ToDouble(Console.ReadLine())); } catch (NoFuelLeftException StrFuel) { Console.WriteLine(StrFuel); } break; case "7.12": //Case use for 7.11 exercise that is used for create hash table, add object in it. HashTblCar objHashTblCar = new HashTblCar(); objHashTblCar.HashTblSort(); //create object for class break; default: Console.WriteLine(Constant.strEntrNch); //enter no choice break; } Console.WriteLine(Constant.strEntrCyn); // Gather information that you want continue or not chr = Char.Parse(Console.ReadLine()); // Read value of character } while (chr == 'Y' || chr == 'y'); if (chr == 'N' || chr == 'n') { Console.WriteLine(Constant.strMsg); // Display message if you press N Console.ReadLine(); } } catch (Exception ex) { System.Console.WriteLine(ex.Message.ToString()); // throw exception Console.Read(); } finally { strS = null; objVowel = null; objSvowel = null; objCaseCheck = null; //REALLOCATE THE MEMORY objdt = null; objReverse = null; objPowerNum = null; objWindowName = null; objReverse1 = null; objSearchArray = null; objReviseArray = null; objCopyArray = null; objNotePadApplication = null; objDateArray = null; objTextFile = null; objReadTextFile = null; objDriver = null; objCar = null; objCar2 = null; objCar3 = null; objCar4 = null; objCar5 = null; objArmoredVehicle = null; objCarArmoredVcle = null; objCarArmoredVcle1 = null; } }