70 likes | 265 Views
計算機概論 vb 程式語言. 指導教授 : 謝慶 存 學生 : 洪聖鈞 車輛一甲 4a115057. 汽車租賃公司計價系統. 使用 Visual Basic 簡稱 VB. 程式碼 -1. 程式碼 -2. Public Class Form1 Dim total, accTotal As Integer Private Sub Form1_Load( ByVal sender As System.Object , ByVal e As System.EventArgs ) Handles MyBase.Load
E N D
計算機概論vb程式語言 指導教授:謝慶存 學生:洪聖鈞 車輛一甲 4a115057
汽車租賃公司計價系統 • 使用 Visual Basic • 簡稱VB
程式碼-2 • Public Class Form1 • Dim total, accTotal As Integer • Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load • Label6.Text = "$" & total & "元﹐" • Label7.Text = "累O計p:$" & accTotal & "元﹐" • Label6.Font = New Font("新Ps細O明u體e", 24) • Label6.ForeColor = Color.Red • total = 0 accTotal = 0 • End Sub • Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click • total = Val(TBoxPrice1.Text) * Val(TBoxQty1.Text) + Val(TBoxPrice2.Text) * Val(TBoxQty2.Text) + Val(TBoxPrice3.Text) * Val(TBoxQty1.Text) • If total > 2000 Then RadioButton3.Checked = True • If RadioButton1.Checked = True Then total = total * 0.9 • If RadioButton2.Checked = True Then total = total * 0.8 • If RadioButton3.Checked = True Then total = total * 0.75 • If CheckBox1.Checked = True Then total = total + 1000 • If CheckBox2.Checked = True Then total = total + 1000 • If CheckBox3.Checked = True Then total = total + 1000 • Label6.Text = "$" & total & "元﹐" • accTotal = accTotal + total • Label7.Text = "累O計p:$" & accTotal & "元﹐" • ListBox1.Items.Add(total & "-->" & "雙uB進i口f車LR" & TBoxPrice1.Text & "*" & TBoxQty1.Text & "國Xe產£車LR" & TBoxPrice2.Text & "*" & TBoxQty2.Text & "商XO用DI貨f車LR" & TBoxPrice3.Text & "*" & TBoxQty3.Text) • End Sub • Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click • TBoxQty1.Text = 0 • TBoxQty2.Text = 0 • TBoxQty3.Text = 0 • total = 0
折價功能程式碼 計價功能程式碼
使用狀況 • 使用 結果一切正常
心得 • 頭一次使用VB寫程式語言,感覺超級難。摸索了很久,靠同學,課本和老師的教導才完成這程式,很有成就感,真的!!老師新年快樂~~你好帥!!真的