using System.Collections.Generic;
using System.Threading.Tasks;
public static void Main()
Program p = new Program();
public void printCollection()
Console.Out.WriteLine("Hello printCollection");
Car ford = new Car("Ford");
Car audi = new Car("Audi");
Car chevy = new Car("Chevy");
Car volvo = new Car("Volvo");
List<Car> myCars = new List<Car>();
Console.Out.WriteLine("\nPrinting the cars in the order in which they were inserted");
foreach(Car c in myCars) {
Console.Out.WriteLine(c.getModel());
Console.Out.WriteLine("\nPrinting the cars in the order of coolness");
foreach(Car c in myCars) {
Console.Out.WriteLine(c.getModel());
class Car : Automobile, IComparable<Car> {
public string getModel() {
public int CompareTo(Car other) {
int car1 = -1, car2 = -1;
string[] coolness = new string[] {"Volvo", "Audi", "Chevy", "Ford"};
for(int i = 0; i < coolness.Length; i++) {
if(getModel() == coolness[i]) {
if(other.getModel() == coolness[i]) {