Dont respond with email address no pymnt!!! Programming question: How do you pro
ID: 440948 • Letter: D
Question
Dont respond with email address no pymnt!!! Programming question: How do you program based on req's? 1. user enter weight of package slelects destination US, Hawaii, Alaska 2. shipping cost is calculatedbased on rates; 2lbs. = 3.69; 4lbs =4.86 20% charge added to Hawaii and 26% charge to Alaska 3. must be able to clear weight and shipping cost and display shipping charge in label after pressing calculate button.Explanation / Answer
Public Class MailShipping Private Sub btnClear_Click(sender As System.Object, e As System.EventArgs) Handles btnClear.Click txtWeight.Text = Nothing radAlaska.Checked = False radHawaii.Checked = False radUS.Checked = False lblOutput.Text = Nothing End Sub Private Sub btnCalculate_Click(sender As System.Object, e As System.EventArgs) Handles btnCalculate.Click Dim cost() As Decimal = {3.69, 4.86, 5.28, 5.98, 6.15, 9} Dim weightMax() As Integer = {2, 4, 6, 8, 10, 30} Dim idx As Integer = 0 Dim weight = CDbl(txtWeight.Text) Dim percentFee As Decimal Dim totalCost As Decimal Do While (weight > weightMax(idx)) And (idx < (weightMax.Length - 1)) idx = idx + 1 Loop If radAlaska.Checked = True Then percentFee = 0.26 ElseIf radHawaii.Checked = True Then percentFee = 0.2 Else percentFee = 0 End If totalCost = (1 + percentFee) * cost(idx) lblOutput.Text = "The cost is " + FormatCurrency(totalCost) End Sub End ClassRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.