據說…我的證照考終於告一段落了(?)
還好,兩次都有過(!)
不過實戰實在讓人感到荒張(!?)
今天來寫寫軟體設計丙級檢定考的內容好了~
嘛~第一站抽到1,3,5題,第二站的時候第7題(030川)
來說說高速公路車輛統計這題好了..
再第二站中…我覺得這題比其他兩題複雜些(?)
'*本程式碼出自天烆の焰界-天烆* 'http://inori.atifans.net Dim w1, nl(4) As String Dim n2, n3, n4, n5, su(7), st, sut(7), c(4), ct(4), a, cc(4) As Integer Dim al(7), ali(7) As Label Dim at(7) As TextBox Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load FileOpen(1, "c:\940307.sm", OpenMode.Input) Do While Not EOF(1) Input(1, w1) : Input(1, n2) : Input(1, n3) : Input(1, n4) : Input(1, n5) Select Case w1 Case "MONDAY" su(1) += n2 + n3 + n4 + n5 st += su(1) Case "TUESDAY" su(2) += n2 + n3 + n4 + n5 st += su(2) Case "WEDNESDAY" su(3) += n2 + n3 + n4 + n5 st += su(3) Case "THURSDAY" su(4) += n2 + n3 + n4 + n5 st += su(4) Case "FRIDAY" su(5) += n2 + n3 + n4 + n5 st += su(5) Case "SATURDAY" su(6) += n2 + n3 + n4 + n5 st += su(6) Case "SUNDAY" su(7) += n2 + n3 + n4 + n5 st += su(7) End Select c(1) += n2 : c(2) += n3 : c(3) += n4 : c(4) += n5 Loop For i = 1 To 4 cc(i) = c(i) Next Array.Sort(c) For i = 1 To 4 Select Case c(i) Case cc(1) a = 1 Case cc(2) a = 2 Case cc(3) a = 3 Case cc(4) a = 4 End Select nl(i) = Choose(a, "大型車", "中型車", "小型車", "公務車") Next For i = 1 To 7 sut(i) = 500 * su(i) / st Next i For i = 1 To 4 ct(i) = 450 * c(i) / st Next FileClose() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For i = 1 To 4 GroupBox1.Controls.Remove(al(i)) GroupBox1.Controls.Remove(ali(i)) GroupBox1.Controls.Remove(at(i)) Next For i = 1 To 7 at(i) = New TextBox at(i).Left = 100 : at(i).Width = 100 at(i).Top = i * 30 - 10 GroupBox1.Controls.Add(at(i)) ali(i) = New Label ali(i).Left = 40 : ali(i).Width = 50 ali(i).Top = i * 30 - 5 GroupBox1.Controls.Add(ali(i)) at(i).BackColor = Color.Red at(i).Width = sut(i) al(i) = New Label al(i).Left = at(i).Left + at(i).Width + 5 al(i).Top = i * 30 - 5 GroupBox1.Controls.Add(al(i)) al(i).Text = Format(su(i), "###,###,###") Next GroupBox1.Text = "依星期別" ali(1).Text = "星期一" : ali(2).Text = "星期二" : ali(3).Text = "星期三" : ali(4).Text = "星期四" : ali(5).Text = "星期五" : ali(6).Text = "星期六" : ali(7).Text = "星期日" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click For i = 1 To 7 GroupBox1.Controls.Remove(al(i)) GroupBox1.Controls.Remove(ali(i)) GroupBox1.Controls.Remove(at(i)) Next For i = 1 To 4 at(i) = New TextBox at(i).Left = 100 : at(i).Width = 100 at(i).Top = i * 30 - 10 GroupBox1.Controls.Add(at(i)) ali(i) = New Label ali(i).Left = 40 : ali(i).Width = 50 ali(i).Top = i * 30 - 5 GroupBox1.Controls.Add(ali(i)) at(i).BackColor = Color.Blue at(i).Width = ct(i) al(i) = New Label al(i).Left = at(i).Left + at(i).Width + 5 al(i).Top = i * 30 - 5 GroupBox1.Controls.Add(al(i)) al(i).Text = Format(c(i), "###,###,###") ali(i).Text = nl(i) GroupBox1.Text = "依車輛種類" Next End Sub
說起天烆我再考第二站的時候好悲劇(!?)
拖到了最後一秒才完成(汗
嗯…..有興趣可以參考一下天烆我設計的程式碼,是使用動態元件的方法來產生。
紅色的部分,題本上他所給的公式
車輛
3000 × 某類型車總計數量 / 所有車輛的加總
星期
3000 × 某星期別總計數量 / 所有車輛的加總
如果用3000的話有出錯的可能….寬度太長了(汗
每一筆.T01的資料都不一樣,建議設小一點,這部分大家可以試試看
下星期段考,11月還要考丙級呢(思…
好吧,今年年底真忙(逃
連放三天阿~放完又是段考呢(汗
聽說重新排序車種名稱還可以再簡化的樣子(?)
執行結果:
恭喜你考過軟設丙級啊!^^
既然丙級都考過了,那就朝著乙級加油吧!XD
謝謝^^
乙級…(遠望