Hallo can someone please help me, I've got this table:

Valuation Date Construction
30/03/2009 30,625.26
30/04/2009 269,825.04
30/05/2009 850,056.45
30/06/2009 1,922,475.06
30/07/2009 3,500,852.19
30/08/2009 5,757,055.16
30/09/2009 8,699,041.1
30/10/2009 12,232,330.17
30/11/2009 16,612,763.46
30/12/2009 19,166,542.19
30/01/2010 22,098,191.54
28/02/2010 33,539,289.47
30/03/2010 40,518,025
30/04/2010 48,372,377.98
30/05/2010 56,543,248.62
30/06/2010 65,507,314.28
30/07/2010 74,607,415.4
30/08/2010 84,352,063.34
30/09/2010 94,325,187.87
30/10/2010 104,060,459.19
30/11/2010 114,040,884.2
30/12/2010 119,094,482.8
30/01/2011 124,342,210.61
28/02/2011 140,316,539.09
30/03/2011 146,909,564.95

Calculated from this formula:

public string Calculation(double b, DateTime validation, DateTime start, DateTime end, double alpha, double beta)
    {
            //start date(t1) 
        System.TimeSpan sp_start =
            validation.Subtract(start);
        string sp_start_str = sp_start.TotalDays.ToString("#");
        double t1 = double.Parse(sp_start_str);

            // change accordingly
        if (validation.Month == 12)
            t1 = t1 - 14;
        if (validation.Month == 01)
            t1 = t1 - 28;

            // end date(t2)
        System.TimeSpan sp_end =
            end.Subtract(start);
        string sp_end_str = sp_end.TotalDays.ToString("#");
        double t2 = double.Parse(sp_end_str);
        t2 = t2 - 28;

        double divide = (t1) / (t2);
        double minus1 = (1 - (divide));
        double pow1 = 1 - (Math.Pow(minus1, alpha));
        double calculation = Math.Round(b * (Math.Pow(pow1, beta)), 2);
        
        return String.Format("{0:#,###,###,###.##}", calculation);
    }

What i need to do is:
The first January, all the months following t2 = 28;
After the second January, all the months following t2 = 56;

I probably need to use a for loop??? But not sure how to go about this.
Please someone help!!

Thanks.

wot will be your output would lok like..
show me and i'll give u code..

Valuation date Construction cash flow
2009/06/30 8,589.80
2009/07/31 90,010.13
2009/08/31 325,292.44
2009/09/30 772,616.42
2009/10/31 1,536,130.38
2009/11/30 2,637,481.30
2009/12/31 3,446,519.60
2010/01/31 4,405,369.56
2010/02/28 6,345,742.52
2010/03/31 9,081,535.16
2010/04/30 12,395,536.71
2010/05/31 16,603,000.72
2010/06/30 21,550,624.14
2010/07/31 25,468,000.00

Values from the database:
cost = 25,468,000
start date = 2009/06/05
end date = 2010/07/20
valuation day = 31
holiday = 1

alpha and beta values
construction_a = 0.9785
construction_b = 2.90971
top_a = 0.8532
top_b = 1.8546
bottom_a = 1.05007
bottom_b = 3.84159

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.