Write a program to calculate the balance and minimum payment for a credit card s
ID: 675009 • Letter: W
Question
Write a program to calculate the balance and minimum payment for a credit card statement. See Fig. 5.27. The program should use the event procedure shown in Fig 5.28. The finance charge is 1.5% of the old balance. if the new balance is $20 or less, the minimum payment should be the entire new balance. Otherwise, the minimum payment should be $20 plus 10% of the amount of the new balance above $20.
Event procedure for Exercise 10:
PrivateSub btnCalculate_Click (...) Handles btnCalculate.Click
Dim oldBalance, charges, credits, newBalance, minPayment As Double
CalculateNewValues (oldBalance, charges, credits, newBalance, minPayment)
DisplayData (newBalance, minPayment)
End Sub
Explanation / Answer
Public Class Form1 Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click Dim oldBalance, charges, credits, newBalance, minPayment As Double InputData(oldBalance, charges, credits) CalculateNewValues(oldBalance, charges, credits, newBalance, minPayment) DisplayData(newBalance, minPayment) End Sub Sub InputData(ByRef oldBalance As String, ByRef charges As String, ByRef credits As String) oldBalance = CDbl(txtOldBal.Text) charges = CDbl(txtCharges.Text) credits = CDbl(txtCredits.Text) End Sub Sub CalculateNewValues(ByRef oldBalance As Double, ByRef charges As Double, ByRef credits As Double, ByRef newBalance As Double, ByRef minPayment As Double) Dim rate As Double = 1.015 newBalance = (rate * oldBalance) + charges - credits If newBalanceRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.