public static void Run() { ModuleCAResults mcar = new ModuleCAResults("EAD1", "Gavin Kenna", 12); mcar["CA1"] = "B+"; mcar["CA2"] = "A-"; mcar["CA4"] = "C"; mcar["CA3"] = "A+"; Console.WriteLine("CA3 is :: "+mcar["CA3"]); Console.WriteLine(mcar.ToString()); Console.Read(); }
static void Main() { //Double x, y; //try //{ // Console.WriteLine("Enter First number to Divide:"); // x = Double.Parse(Console.ReadLine()); // Console.WriteLine("Enter Second number to Divide:"); // y = Double.Parse(Console.ReadLine()); // Console.WriteLine(x + "/" + y + " = " + Calculator.Divide(x, y)); // Console.ReadKey(); //} //catch (FormatException) //{ // Console.WriteLine("Invalid Format, must be a number."); // Console.ReadKey(); //} //catch (OverflowException) //{ // Console.WriteLine("Overflow Exception"); // Console.ReadKey(); //} //catch (DivideByZeroException) //{ // Console.WriteLine("Cannot Divide by zero"); // Console.ReadKey(); //} try { ModuleCAResults mca = new ModuleCAResults("SDEV", 10, "John"); mca[mca.length] = 10; mca[mca.length] = 20; Console.WriteLine(mca.ToString()); Console.ReadKey(); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); Console.ReadKey(); } }