View
55
Download
5
Category
Preview:
DESCRIPTION
計算機概論期末報告. 收. 費. 系. 統. 奈米一乙 4A014045 薛宇翔. 題目說明. 此系統為先輸入您進場時間,取得一收費價錢,因為擁有者報告作的辛苦,所以知道學分難賺,在此做個抽獎娛樂大家,按抽獎鍵取得一折扣數值,再選擇你所抽中之折扣數,即會顯示出最終應付之金額。. 使用說明. 選擇進場之時間及日期,按 停車金額鍵 ,即會取得停車之時間及金額。. 使用說明. 按 抽獎鍵 ,即會取得一折扣數。. 使用說明. 選擇所抽中之 折扣數值 ,即會出現所應付之日圓金額。. 版面配置屬性設定. 折扣圖片 PictureBox1. 時間標題 Label3. - PowerPoint PPT Presentation
Citation preview
版面配置屬性設定
折扣圖片PictureBox1
中獎圖示Label1
抽獎鍵Button1
折扣選擇GroupBox1
RadioButton1RadioButton2RadioButton3RadioButton4RadioButton5
應付金額顯示Label2
結算停車費鍵Button2
選擇進場時間DtpstarTime1
進場時間標題Label5
顯示現在時間Label4
時間標題Label3
顯示停車費Label6
程式碼1 Public Class Form1
2 Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
3 tmrNow.Interval = 1000
4 tmrNow.Enabled = True
5 DtpstarTime.Format = DateTimePickerFormat.Custom
6 DtpstarTime.CustomFormat = "yyyy/M/d HH:mm"
7 DtpstarTime.ShowUpDown = True
8 DtpstarTime.MaxDate = Now
9 lb2price.Text = " 停車費為 °"
10 Me.Text = " 收費打折系統 "
11 Lb1point.Text = " 先按抽獎 "
12 Label2.Text = " 應付金額“
13 End Sub
程式碼 15 Private Sub btnok_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnok.Click
16 Dim getpoint As Integer
17 Randomize()
18 getpoint = Fix((9 - 5 + 1) * Rnd()) + 5
19 PICdice.Image = Image.FromFile(CStr(getpoint) & ".jpg")
20 Lb1point.Text = " 恭喜獲得 " & getpoint & " 折 !!"
21 End Sub
22
23 Private Sub tmrnow_Tick(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles tmrnow.Tick
24 lnow.Text = Now.ToString
25 End Sub
程式碼 27 Private Sub btn0k2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn0k2.Click
28 Dim total_hours, day, hours, price As Integer
total_hours = DateDiff(DateInterval.Hour, DtpstarTime.Value, Now)
29 day = Int(total_hours / 24)
30 hours = total_hours Mod 24
31 price = 1000 * day
32 Select Case hours
33 Case Is >= 1 : price += 500
34 End Select
35 lb2price.Text = " 共停 " & day & " 天 " & hours & " 小時 " &
" 停車費為 " & price & " 日圓 "
36 End Sub
程式碼38 Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged, RadioButton4.CheckedChanged, RadioButton3.CheckedChanged, RadioButton2.CheckedChanged, RadioButton1.CheckedChanged39 Dim total_hours, day, hours, price As Integer40 total_hours = DateDiff(DateInterval.Hour, DtpstarTime.Value, Now)41 day = Int(total_hours / 24)42 hours = total_hours Mod 2443 price = 1000 * day44 Select Case hours45 Case Is >= 1 : price += 50046 End Select47 If RadioButton1.Checked = True Then price = price * 0.548 If RadioButton2.Checked = True Then price = price * 0.649 If RadioButton3.Checked = True Then price = price * 0.750 If RadioButton4.Checked = True Then price = price * 0.851 If RadioButton5.Checked = True Then price = price * 0.952 Label2.Text = "¥FD" & price53 End Sub54 End Class
程式碼說明
3~4 行要顯示時間必且每秒更新一次。5~6 行設定時間格式,並且進場時間不可晚於出場時間。9~12 行執行一開始 Label 所顯示之內容。16 行宣告它為一數值。18 行產生一 9~5 之亂數 。19 行讓產生之亂數值找到所配合之圖片。20 行顯示出恭喜獲得?折扣。
Recommended