我将提供附件表格和代码(我希望这完全是完整的)。因为我刚接触这个,所以我整天都在苦苦挣扎。感谢您的任何帮助或指导。
类应该是只读的。(平衡(需要保存值dblBalance),intRate,Interest,intTrans)
**需要的方法** :计算利息,提取,存款 她给出的提示是第一,得到利率输入。应该在form_load事件中 表格应该
1)允许存款
2)允许提款
3)计算利率(dblInterestEarned = dblBalance *(dblIntRate / 12))
4)随时报告当前的交易数量 - intTrans + = 1。 并明显退出
*编辑我只是觉得我搞得很糟糕,并且比以前更难。太累了我道歉。刚刚实现了Form.vb中的程序。当表单加载输入框时,应首先弹出*****
表格[1] http://imgur.com/35Adk2G
Public Class Class1
'Create member variables for properties
Private dblBalance As Double
Private dblIntRate As Double
Private dblInterest As Double
Private intTrans As Integer
Private dblMakeWithdrawal As Double
Private dblMakeDeposit As Double
Private dblInterestEarned As Double
'Create property procedures
Public Property Balance As Double
Get
Return dblBalance
End Get
Set(value As Double)
dblBalance = value
End Set
End Property
Public Property IntRate As Double
Get
Return dblIntRate
End Get
Set(value As Double)
dblIntRate = value
End Set
End Property
Public Property InterestTotal As Double
Get
Return InterestTotal
End Get
Set(value As Double)
InterestTotal = value '''''''*expression recursively calls property interest total
End Set
End Property
''trying to
'''calculate the amount of interest for the current period,
''' stores this value in the Interest property, and adds it to the Balance property.
Public Sub addInterest(ByVal addInterest As Integer)
dblInterestEarned = dblBalance * (dblIntRate / 12)
End Sub
''trying to add deposit
Public Sub addDeposit(ByVal addDeposit As Double)
dblMakeDeposit += addDeposit
End Sub
'''''to withdraw
Public Sub subtractWithdrawl(ByVal subtractWithdrawal As Double)
If dblMakeWithdrawal >= subtractWith() Then
dblMakeWithdrawal -= subtractWith()
Else
MessageBox.Show("No sufficient balance")
End If
End Sub
Private Function subtractWith() As Double
Throw New NotImplementedException
End Function
End Class
Imports System.IO
Public Class Form1
Dim dblMakeWithdrawal As Double
Private Sub btnDeposit_Click(sender As Object, e As EventArgs) Handles btnDeposit.Click
Dim dblMakeDeposit As Double
'''''how to capture inputs from the form load??
'Add Deposit
dblMakeDeposit = CDbl(InputBox("Please enter deposit if you have any"))
End Sub
Private Sub btnWithdraw_Click(sender As Object, e As EventArgs) Handles btnWithdraw.Click
Dim dblBalance As Integer
dblMakeWithdrawal = CDbl(InputBox("Please enter an amount to withdraw")
If dblBalance <= 0 Then
MessageBox.Show("Insufficient funs")
End If
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'''This is where to put the input box when the form loads? so the read only 3D display boxes update on form?
End Sub
Private Sub GetData(objAccount As Account)
Throw New NotImplementedException
End Sub
End Class
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class