public static void Main()
Console.WriteLine("Hello World");
List<myInterface> options = new List<myInterface>();
myInterface cheapestOption;
for(int i = 0; i < options.Count - 1; i++)
if(options[i].GetCost() > options[i+1].GetCost())
cheapestName = options[i+1].GetName();
cheapestName = options[i].GetName();
List<myInterface> options = new List<myInterface>();
myInterface cheapestOption = options[0];
foreach(var option in options)
if(option.GetCost() < cheapestOption.GetCost())
return cheapestOption.GetName();
myInterface vehicleOpt1 = new VehicleOption(5000.5, 5, 750.33, 2.85);
myInterface transporterOpt1 = new TransporterOption(150.25, 15);
if vehicleOpt1.GetCost() > transporterOpt1.GetCost()
return "Transporter is a cheaper option";
else if transporterOpt1.GetCost() > vehicleOpt1.GetCost()
return "Vehicle is a cheaper option";
return "Both options cost the same";
public interface myInterface
public class VehicleOption : myInterface
decimal myCostVehicle, myAmmount, myCostFuel;
public VehicleOption(decimal costVehicle, int numberVehicle, decimal ammount, decimal costFuel)
myCostVehicle = costVehicle;
myNumberVehicle = numberVehicle;
return myCostVehicle * myNumberVehicle + myAmmount * myCostFuel;
return myCostFuel/amount;
public class TransporterOption : myInterface
decimal myLicenseFeeCost;
public TransporterOption(decimal licenseFeeCost, int numberOfUse)
myLicenseFeeCost = licenseFeeCost;
myNumberOfUse = numberOfUse;
return myLicenseFeeCost * myNumberOfUse;
return myNumberOfUse/myLicenseFeeCost;
List<Shape> shapes = new List<Shape();
shapes.append(new Square(5));
shapes[0].GetPerimeter();
public virtual decimal GetArea()
public virtual decimal GetPerimeter()
public class Square : Shape
public Square(decimal length)
public Square(decimal length, string color)
public void ChangeLength(decimal length)
public void ChangeLength(string length)
myLength = Integer.GetNumber(lenght);
public override decimal GetArea()
return myLength * myLength;
public override decimal GetPerimeter()
private decimal myLength;
public void myRectangle(decimal length, decimal width)
return myLength * myWidth;
public decimal GetPerimether()
return (myLength + myWidth) * 2;
private decimal myRadius;
private const decimal Pi = 3.14;
public void myCircle(decimal radius)
return Pi * myRadius ^ 2;
public decimal GetPerimether()
return 2 * Pi * myRadius;
private decimal myHeight;
public void myTriangle(decimal height, decimal a, decimal b, decimal c)
public decimal GetPerimether()