This windows application finds the amount of your pay if your pay is doubled each day, starting with a penny a day or a nickel a day. Instead of one month's salary, a boss offers her new employees a penny the first day and experienced employees a nickel the first day under a new pay system. Each day the pay will double.
Restriction: The minimum number of days for the pay period is 19 days for the new employees and 16 days for the experienced. The maximum number of days in a pay period is 22 days.
I have everything working except the double your pay each day part.This is what I have so far......
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click Dim intNumberOfDays As Integer Const decPenny As Decimal = 0.01D Const decNickel As Decimal = 0.05D Dim decAmountDisplay As Decimal Dim decChosenPay As Decimal Const decDouble As Decimal = 2D Dim decTotalOfDayPay As Decimal 'This code validates the user input as numeric and a positive number. If IsNumeric(Me.txtNumberOfDays.Text) Then intNumberOfDays = Convert.ToInt32(Me.txtNumberOfDays.Text) If intNumberOfDays > 0 Then 'This code will extract what the user has chosen as their first day pay rate. If radPenny.Checked = True Then decChosenPay = decPenny ElseIf radNickel.Checked = True Then decChosenPay = decNickel End If 'This code will double the pay rate each day after the first day If intNumberOfDays > 1 Then Me.lstDisplay.Items.Add(decChosenPay) decChosenPay += decTotalOfDayPay decAmountDisplay = decChosenPay * decDouble decAmountDisplay = intNumberOfDays * decChosenPay Me.lblAmountDisplay.Text = decAmountDisplay.ToString("C") Me.lblAmountDisplay.Visible = True Else MessageBox.Show("You entered a negative value, please enter a number greater than zero!", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.txtNumberOfDays.Clear() Me.txtNumberOfDays.Focus() End If Else 'Display MessageBox if negative or nonnumeric value is entered MessageBox.Show("You entered an invalid value, please try again!", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.txtNumberOfDays.Clear() Me.radNickel.Checked = False Me.radPenny.Checked = True Me.lblAmountDisplay.Visible = False Me.btnCalculate.Enabled = True End If End If
I don't know how to use loops to "double your pay" :(
Edited 6 Years Ago by ndshah: n/a