static void Main(string[] args) { DaysTemp temp = new DaysTemp(); // Create the object temp.High = 85; // Assign to the fields temp.Low = 60; Console.WriteLine("High: {0}", temp.High); // Read from fields Console.WriteLine("Low: {0}", temp.Low); }
static void Main(string[] args) { // Create two instances of DaysTemp DaysTemp t1 = new DaysTemp(); DaysTemp t2 = new DaysTemp(); // Write to the fields of each instance t1.High = 76; t1.Low = 57; t2.High = 75; t2.Low = 53; // Read from the fields from each instance // Call the method of each instance Console.WriteLine("t1: {0}, {1}, {2}", t1.High, t1.Low, t1.Average()); Console.WriteLine("t2: {0}, {1}, {2}", t2.High, t2.Low, t2.Average()); }
static void Main(string[] args) { DaysTemp dt = new DaysTemp(); float avg = dt.Average(); Console.WriteLine(avg); }