TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sarah Nel
NA
19
0
for loop ???
Apr 21 2010 3:51 AM
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:
<code>
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);
}
</code>
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.
Reply
Answers (
2
)
Setup Wizard Banner in Vistual Studio 2008
Can Datalogic MEmor can be program to beep using vb.net?