static void Main(string[] args) { Person kyle = new Person("Kyle"); Person Jane = new Person("Jane"); Person kyle2 = new Person("Kyle"); Truck chevy = new Truck(kyle, Manufacturer.Chevrolet, 8, 2000, 10000); Truck chevy2 = new Truck(kyle2, Manufacturer.Chevrolet, 8, 2000, 10000); Truck ford = new Truck(Jane, Manufacturer.Ford, 10, 3000, 12000); Console.WriteLine(chevy.ToString()); Console.WriteLine($"Does truck 1 = truck 2: {chevy.Equals(chevy2)}"); Console.WriteLine($"Does truck 1 = truck 3: {chevy.Equals(ford)}"); }
static void Main(string[] args) { Person p1 = new Person(); Person p2 = new Person("Grant"); Vehicle v1 = new Vehicle(); Vehicle v2 = new Vehicle(Vehicle.Manufacturer.Ford, 4, p2); p1.SetName("Bob"); v1.SetOwner(p1); v1.SetManufacturer(Vehicle.Manufacturer.Lexus); v1.Cylinder = 6; Console.WriteLine(v1.ToString()); Console.WriteLine(v2.ToString()); if (v1.Equals(v2)) { Console.WriteLine("the vehicles ARE equal"); } else { Console.WriteLine("the vehicles ARE NOT equal"); } Console.WriteLine(); Person p3 = new Person("Bill"); Person p4 = new Person(p3); Truck t1 = new Truck(); Truck t2 = new Truck(Vehicle.Manufacturer.Chevrolet, 2, p4, 75, 50); t1.SetManufacturer(Vehicle.Manufacturer.Chevrolet); t1.SetOwner(p3); t1.Cylinder = 2; t1.Load = 75; t1.Towing = 50; Console.WriteLine(t1.ToString()); Console.WriteLine(t2.ToString()); if (t1.Equals(t2)) { Console.WriteLine("the trucks ARE equal"); } else { Console.WriteLine("the trucks ARE NOT equal"); } Console.ReadLine(); }