Ejemplo n.º 1
0
    public static void Main()
    {
        Home        myhome;
        ContractorA contractorA = new ContractorA();
        ContractorB contractorB = new ContractorB();

        int estimatedCA = contractorA.Estimated();
        int estimatedCB = contractorB.Estimated();

        Console.WriteLine($"ContractorA is charging ${estimatedCA}");
        Console.WriteLine($"ContractorB is charging ${estimatedCB}");

        if (estimatedCA < estimatedCB)
        {
            myhome = new Home(contractorA);
        }
        else
        {
            myhome = new Home(contractorB);
        }

        myhome.StartRenovation();

        Console.WriteLine($"The contractor that will renovate the house is {myhome.WhoGotHired()}");
        Console.WriteLine($"The Kitchen will be done on {myhome.Kitchen}");
        Console.WriteLine($"The Bathroom will be done on {myhome.Bathroom}");
        Console.WriteLine($"The Bedroom will be done on {myhome.Bedroom}");

        Console.ReadLine();
    }
Ejemplo n.º 2
0
    public static void Main()
    {
        House       myhouse;
        ContractorA contractorA = new ContractorA();
        ContractorB contractorB = new ContractorB();

        if (contractorA.Estimate() < contractorB.Estimate())
        {
            myhouse = new House(contractorA);
        }
        else
        {
            myhouse = new House(contractorB);
        }

        myhouse.StartRenovation();

        Console.WriteLine($"The contractor that is going to renovate my house is {myhouse.WhoGotHired()}");
        Console.WriteLine($"This contractor charged me {myhouse.HowMuchContractorCharged()}");

        Console.WriteLine($"The kitchen will be done on {myhouse.Kitchen}");
        Console.WriteLine($"The bathroom will be done on {myhouse.Bathroom}");
        Console.WriteLine($"The bedbroom will be done on {myhouse.Bedbroom}");

        Console.ReadLine();
    }