VB.NET Question on a calculation

Persson

New member
Joined
Feb 24, 2005
Messages
2
Programming Experience
1-3
Hi, I am trying to figure out a calculation that I need to complete for a project. I have created a Namespace titled "CreditScore". The project wants me to calculate a credit score based on the following information:

*100 points are awarded for each $10,000.00 of income, That is 110 points would be awarded for $11,000.00 in annual income.
*25 points are deducted for each $10,000.00 of annual revolving debt
*15 points are deducted for each $10,000.00 in annual house payments
*25 points are deducted for each late payment
*15 points are deducted for each dependent
*15 points are awarded for each $10,000.00 in the bank
*50 points are awarded if a person owns their own home outright

I have got this much figured out but I can't pull it together.

AnnualIncome/1,000 = ? * 10
RevolvingDebit/10,000 = ? * -25
LatePayments * -25 = ?
Dependents * -15 = ?
Cash/10,000 = ? * 15 = ?
If Checkbox = True Then points = 50

Well this is what I have I just can't pull it together. If you can help...I would appreciate it so much.

Desperate in Kentucky,



Elvira Persson
 

malitice

Active member
Joined
Feb 20, 2005
Messages
41
Programming Experience
1-3
VB.NET:
		Dim points As Integer = 0
		points += 10 * (AnnualIncome.Text / 1000)
		points += -25 * (RevolvingDebit.Text / 10000)
		points += LatePayments .Text * -25
		points += Dependents .Text * -15
		points += 15 * (Cash.Text / 10000)
		If CheckBox4.Checked = True Then points += 50

		Label1.Text = points

All you need is the appropriate textboxes, checkbox and labels. The information it gives out appears to be correct.
 

mathpath

Active member
Joined
Aug 21, 2004
Messages
27
Programming Experience
10+
If you'd like the code to be more robust, you could replace the xxx.text expressions by VAL(xxx.text). This way, the program will not fail when someone leaves the textbox blank, or enters an alpha character.

You may want to check out the rules to see if the point increments are in slices of $100, in which case the code will be different.

For negative increments, you could use the syntax:

Point -= 25*Val(RevolvingDebit.text/10000)

Happy programming.
 
Top Bottom