下載/瀏覽Download

Download Report

Transcript 下載/瀏覽Download

題目:南台專賣店
: 南台科技大學
•系所 : 機械工程系
•班級 : 自控一甲
•學號 : 4A212070
•學生 : 林韋甫
•指導老師 : 謝慶存
•學校

學習重點

Label、Button、PictureBox、TextBox、
ListBox、GroupBox、RadioButton之使用方法

設計黑心專賣店結帳系統,填寫數量再按下計算
鈕之後,即會顯示結帳總金額。按「清除」按鈕,
再輸入數量,並點選「VIP打六折」,再按下
「計算」鈕,得到打六折後的那一筆總金額資料。

設計黑心專賣店結帳系統,填寫數量再按下計算
鈕之後,即會顯示結帳總金額。按「清除」按鈕,
再輸入數量,並點選「POWER VIP打對折」,
再按下「計算」鈕,得到打對折後的那一筆總金
額資料。
機台
(Label4):
圖片:
PictureBox1
PictureBox2
PictureBox3
價錢(Label5):
數量(Label6):
促銷
TextBoxpirice1
TextBoxpirice1
TextBoxpirice1
TextBoxQty1
TextBoxQty2
TextBoxQty3
(GroupBox1):
RadioButton1
RadioButton2
文字:
Label1
Label2
Label3
金額:
Label7
Label8
價錢計算:
ListBox1
Button1
Button2
物件
屬性
說明
PictureBox1
text
圖片
PictureBox2
text
圖片
PictureBox3
text
圖片
TextBoxPrice1
text
XBOX360價錢
TextBoxPrice2
text
PSVITA價錢
TextBoxPrice3
text
PS3價錢
物件
屬性
說明
TextBox1Qty
text
XBOX360數量
TextBox2Qty
text
PSVITA數量
TextBox3Qty
text
PS3數量
GroupBox1
text
在周圍顯示框架
RadioButton1
text
VIP 打六折
RadioButton2
text
Power Vip 打對折
物件
屬性
ListBox1
說明
由程式控制
Button1
text
清除
Button2
test
計算
 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
Label7.Text = "$" & total & "元﹐"
Label8.Text = "累O計p:G$" & accTotal & "元﹐"
Label7.Font = New Font("標D楷P¢體e", 24)
Label7.ForeColor = Color.Red
total = 0
accTotal = 0
End Sub









Private Sub Button2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button2.Click
total = Val(TextBoxprice1.Text) * Val(TextBoxQty1.Text)
+ Val(TextBoxprice2.Text) * Val(TextBoxQty2.Text) +
Val(TextBoxprice3.Text) * Val(TextBoxQty3.Text)
If RadioButton1.Checked = True Then total = total * 0.6
If RadioButton2.Checked = True Then total = total * 0.5
ListBox1.Items.Add("總`價u" & total & "-->" &
"XBOX360" & TextBoxprice1.Text & "*" & TextBoxQty1.Text
& "PSVITA" & TextBoxprice2.Text & "*" & TextBoxQty2.Text
& "PS3" & TextBoxprice3.Text & "*" & TextBoxQty3.Text)
accTotal = accTotal + total
Label7.Text = "$" & total & "元﹐"
Label8.Text = "累O計p:G$" & accTotal & "元﹐"
End Sub











Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
TextBoxQty1.Text = 0
TextBoxQty2.Text = 0
TextBoxQty3.Text = 0
ListBox1.Items.Clear()
total = 0
accTotal = 0
Label7.Text = "$" & "0" & "元﹐"
Label8.Text = "累O計p:G$" & "0" & "元﹐"
End Sub
End Class
第1 定義總金額及累計金額的參數。
第2 定義總價錢的算法
第3 點選VIP享有六折優惠
第4 Power VIP 享有對折優惠
第5 在ListBox1顯示出計算過程
第6 累計算法
第7 顯示總價錢的方法
第8 顯示累計價錢的方法
第10 為清除數量之框格
第11 累計歸零
第12 總價顯示歸零
第13 計積顯示歸零

Visual Basic是一讓我覺得學起來算蠻困難的東
西因為本身我的電腦就不是說很好了還寫這個程
式根本就是難上加難好在有同學的指導與協助才
能讓我順利的完成這項任務

Visual Basic 2010 基礎必修課
購物天堂 日本遊戲機台
YAHOO奇摩拍賣
老師的用心教導與上課經驗

END


