Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27345

VS 2010 Pennies for Pay

$
0
0
I have the formula for the pennies for pay method. It works and I'm happy with it. The problem I have is the radPay part of the code. I need it so that the user can input the amount of money that they want to make and it will spit out the number of days you need to work using the pennies for pay formula. What am I doing wrong?

Dim intDays As Integer
Dim dblPennies As Double
Dim dblRate As Double
Dim dblDivide As Double
Dim dblTotal As Double
Dim intAmount As Integer
Dim dblActualTotal As Double
Dim dblPenny As Double
Integer.TryParse(txtBox.Text, intAmount)
dblPenny = 0.01
dblRate = 2
dblDivide = 100
intDays = intAmount

If radDay.Checked Then
intDays = intDays - 1
If intDays >= 0 Then
dblPennies = 1
For X = 1 To intDays
dblPennies = dblPennies * dblRate
Next

dblTotal = dblPennies / dblDivide
dblActualTotal = (dblPenny * (dblRate ^ intAmount)) - dblPenny
End If

lblDayTotal.Text = "You will earn" + " " + dblTotal.ToString("C2") + " " + "on that day"
lblTotal.Text = "You will have earned" + " " + dblActualTotal.ToString("C2") + " " + "total"
End If

If radPay.Checked Then
For X = 1 To 10
dblPennies = dblPennies * dblRate
Next
dblActualTotal = intAmount * dblPennies

lblDayTotal.Text = "You Must Work" + " " + dblActualTotal.ToString + " " + "Day(s)"
End If
End Sub



This is the part I need help with:
If radPay.Checked Then
For X = 1 To 10
dblPennies = dblPennies * dblRate
Next
dblActualTotal = intAmount * dblPennies

I know my logic is wrong, but I'm not sure what to do to fix it. Thanks in advance!

Viewing all articles
Browse latest Browse all 27345

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>