Day1-.01 cent
Day2-.02 cent
Day3-.04 cent
Day4-.08 cent
Day5-.16 cent
My code looks like:
Day1-.02 cent
Day2-.04 cent
Day3-.06 cent
Day4-.08 cent
Day5-.10 cent
What is wrong with my code? Can anyone explain to me the right method in what i am doing wrong and need to do.. I'm fairly new at programming and this project been breaking my head all day. Any help will be greatly appreciated
Public Class Form1
'Constant for Starting amount
Const dblPenny As Double = 0.01
Const dblNickel As Double = 0.05
Const dblDime As Double = 0.1
Const dblQuater As Double = 0.25
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
' Declare ounlocal variables
Dim dblPay As Double
Dim intcount As Integer
Dim pay As Decimal
Dim Total As Decimal
Dim decTotal As Decimal
Dim perString As String = 0
lstOutput.Items.Clear()
Dim numDays As Integer = 0
Try
'Getting the starting amount
If radPenny.Checked = True Then
dblPay = dblPenny
ElseIf radNickel.Checked = True Then
dblPay = dblNickel
ElseIf radDime.Checked = True Then
dblPay = dblDime
ElseIf radQuater.Checked = True Then
dblPay = dblQuater
End If
'Getting the Duration
If radThirty.Checked = True Then
numDays = 30
ElseIf radSixty.Checked = True Then
numDays = 60
ElseIf radNinety.Checked = True Then
numDays = 90
ElseIf radOneTwenty.Checked = True Then
numDays = 120
End If
'Calculating the pay
Do While intcount < numDays
intcount += 1
decTotal += 2 * dblPay
perString = decTotal.ToString("c")
lstOutput.Items.Add("Day " & intcount & " your pay is " & perString)
Loop
Catch
End Try


Sign In
Create Account


Back to top









