vb.net - Visual basic - beginning program code -
My output is always 14.95 for package A. Everything else works well.
I need this for the program:
An Internet service, Proskar offers 3 membership packages for its customers, as well as discounts for non-profit organizations
- Packa A: 10 hours of access to $ 9.95 per month. The extra is $ 2.00 per hour.
- Package B: 20 hours of use for $ 14.95 per month. Additional $ 1.00 per package
- Package C: Unlimited access to $ 19.95 per month
- Nonprofit organization: User Nonprofit Checkbox 20% discount cut from final fee Choices should go. Input validation ": The number used in one month can not be more than 744. The value should be numeric
btnCalc_Click < Pre>
public class form1 personal sub btnCalc_Click (as the object, in the form of e EventArgs) handle btnCalc.Click 'variable and consecutive dec decotal declare decimal decimal intHours as integer const decNonProfit decimal = 0.8 Try D intHours = CInt (txtHoursUsed.Text) then CInt (txtHoursUsed.Text)> 744 Then MessageBox.Show ("Monthly Hour It can not be more than 744 ") txtHoursUsed.Text = String.Empty lblTotalDue.Text = String.Empty radPackageA if finished without discount then calculate a package total. Checked = true and intHours> 10 then decTotal = ( 9.95 + (intHours - 10) * 2)) elseif intHours & lt; = 10 then decTotal = 9.95 without discount 'If calculation b package total end then radPackageB.Checked = true and intHours> 20 then decimal = (14.95 ElseIf intHours & lt; = 20 then decTotal = 14.95 end if 'C calculation c package without discount, then radPackageC.Checked = true if decTotal = 19.95 termination' package for total (+ (intHours - 20) * 1) Calculates, non-profits If you are checked, chkNonProfit.Checked = true end decototal = decTotal = decTotal * decNonProfit end if the total show cause the lblTotalDue.Text = decTotal.ToString ("C") capture pre-exception MessageBox.Show ("Input Error") End Sub Try as
btnClear_Click
Private Sub BTN Claire Link (sender as object, and eventRG's Sender in form) Handles BTN Clear Click Red Package A. Check = Fault red packages b. Check = falls red package c. Check = Flex CKN Profit. Checked = Falls LibLotal Due Text = string.extext TSTHours used. Text = string.opti end sub
btnExit_Click
private sub btnExit_Click (as the object, the form of e EventArgs In the handle btnExit.Click Me.Close () and at the end of the sub and class
You need to include your entire conditional check in your selection. What is happening is that your false situation is always being run during repackage. Checked is false.
'Calculate Package Package Without Discount Package' If checked, then enterhore & gt; 10 then decTotal = (9.95 + ((intHours - 10) * 2)) elseif intHours & lt; = 10 then decTotal = 9.95 from second to end, without rebutting 'If calculation B package total if radPackageB.Checked then intHours & gt; 20 then decTotal = (14.95 + ((intHours - 20) * 1)) elseif intHours & lt; If the end counts then without exemption, then the c package total = 20 then decTotal = 14.95 are termination radPackageC.Checked again decTotal = 19.95
Comments
Post a Comment