public Television PickMoreExpensiveTV(Television t1, Television t2) { if (t1.GetPrice() > t2.GetPrice()) { return(t1); } else if (t2.GetPrice() > t1.GetPrice()) { return(t2); } else if (t1.GetPrice() == t2.GetPrice()) { return(t1); } if (t1 == null && t2 != null) { return(t2); } else if (t1 != null && t2 == null) { return(t1); } else if (t1 == null && t2 == null) { return(null); } else { return(null); } }
public void PrintMyTVUsingGetters(Television theTV) { if (theTV == null) { Console.WriteLine("Nothing..."); } else { theTV.SetBrand("Sony"); string brand = theTV.GetBrand(); theTV.SetPrice(1000.17m); decimal price = theTV.GetPrice(); theTV.SetSize(10.5); double size = theTV.GetSize(); Console.WriteLine("The TV's Brand is: {0}, which is rad.", brand); Console.WriteLine("The TV's Price is: {0}, which is really rad.", price); Console.WriteLine("The TV's Size is: {0}, which is wicked rad.", size); } }