Presentation is loading. Please wait.

Presentation is loading. Please wait.

计算机程式及实习 期末报告 题目:战舰少女R氪金系统 班级:车辆一甲 姓名:张文仲 学号:4A415003 老师:謝慶存.

Similar presentations


Presentation on theme: "计算机程式及实习 期末报告 题目:战舰少女R氪金系统 班级:车辆一甲 姓名:张文仲 学号:4A415003 老师:謝慶存."— Presentation transcript:

1 计算机程式及实习 期末报告 题目:战舰少女R氪金系统 班级:车辆一甲 姓名:张文仲 学号:4A 老师:謝慶存

2 学习重点 学习使用ListBox、Button、Label、TextBox、GroupBox等控制程式來完成一个简易式的结账系统
学习控制工具的程式操作及写法

3 题目说明 1.设计一个舰娘氪金系统,其中耗材顺序为燃油,弹药,钢材,铝材。 2.在界面上可以选择所想购买的资材。 3.选择购买数量。
4.打折系统:单次购买超过500,打九折;超过2000,打八折;超过10000,打七折

4 版面配置 TextBox1—TextBox30 Label1 Label2 Label3 Label4 Label5 Label6
GroupBox1 Label19 Label20 Label21 Button1 Button2 ListBox1 Label18

5 系统操作方式 1.输入所需购买资材的数量 2.按下结算按钮进行结算作业 3.若想改变所购买资材数量或种类,按清除按钮即可清除之前的欲购记录
4.折扣方式如右图

6 程式码:设定总金额的参数 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 Label18.Text = "¥" & total & "钻" Label18.Font = New Font("新細明體", 24) Label18.ForeColor = Color.Red total = 0 accTotal = 0 End Sub

7 系统会把此次结算记录至(ListBox1)中
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click total = Val(TextBox1.Text) * Val(TextBox2.Text) + Val(TextBox3.Text) * Val(TextBox4.Text) + Val(TextBox5.Text) * Val(TextBox6.Text) + Val(TextBox7.Text) * Val(TextBox8.Text) + Val(TextBox9.Text) * Val(TextBox10.Text) + Val(TextBox11.Text) * Val(TextBox12.Text) + Val(TextBox13.Text) * Val(TextBox14.Text) + Val(TextBox15.Text) * Val(TextBox16.Text) + Val(TextBox17.Text) * Val(TextBox18.Text) + Val(TextBox19.Text) * Val(TextBox20.Text) + Val(TextBox21.Text) * Val(TextBox22.Text) + Val(TextBox23.Text) * Val(TextBox24.Text) + Val(TextBox25.Text) * Val(TextBox26.Text) + Val(TextBox27.Text) * Val(TextBox28.Text) + Val(TextBox29.Text) * Val(TextBox30.Text) If total >= 500 Then total = total * 0.9 If total >= 2000 Then total = total * 0.8 If total >= Then total = total * 0.7 ListBox1.Items.Add(total & "-->" & "修理船坞扩展" & TextBox1.Text & "*" & TextBox2.Text & "建造船坞扩展" & TextBox3.Text & "*" & TextBox4.Text & "开发工厂扩展" & TextBox5.Text & "*" & TextBox6.Text & "舰船船坞扩张" & TextBox7.Text & "*" & TextBox8.Text & "装备仓库扩张" & TextBox9.Text & "*" & TextBox10.Text & "誓盟之戒" & TextBox11.Text & "*" & TextBox12.Text & "损管" & TextBox13.Text & "*" & TextBox14.Text & "快建" & TextBox15.Text & "*" & TextBox16.Text & "快修" & TextBox17.Text & "*" & TextBox18.Text & "装备蓝图" & TextBox19.Text & "*" & TextBox20.Text & "舰船蓝图" & TextBox21.Text & "*" & TextBox22.Text & "燃料" & TextBox23.Text & "*" & TextBox24.Text & "弹药" & TextBox25.Text & "*" & TextBox26.Text & "钢材" & TextBox27.Text & "*" & TextBox28.Text & "铝材" & TextBox29.Text & "*" & TextBox30.Text) Label18.Text = "¥" & total & "钻" End Sub 进行所买商品价格及数量的运算 进行最终价格是否打折的判定 系统会把此次结算记录至(ListBox1)中 输出最终结果

8 Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
TextBox2.Text = 0 TextBox4.Text = 0 TextBox6.Text = 0 TextBox8.Text = 0 TextBox10.Text = 0 TextBox12.Text = 0 TextBox14.Text = 0 TextBox16.Text = 0 TextBox18.Text = 0 TextBox20.Text = 0 total = 0 ListBox1.Items.Clear() accTotal = 0 Label18.Text = "¥" & total & "钻" End Sub End Class 设定(清除)按钮的归零动作

9 报告心得 Visual Basic其实是套很有趣又好玩的程式设计系统,虽看似简单,但有时候可能因为一个小括号沒有括,程式可能无法执行。对我我这种初学者来说,第一次上手的确很困难,但参考了学长的范例、经过同学的指导后渐渐变得熟练。在老师或者专业程序员来说我的程序可能漏洞百出,但对于我们的程序学习已经有了很大进步。感谢老师的悉心教导!

10 参考资料 诸位学长的范例 网络查询 高中同学的指导 おしまい


Download ppt "计算机程式及实习 期末报告 题目:战舰少女R氪金系统 班级:车辆一甲 姓名:张文仲 学号:4A415003 老师:謝慶存."

Similar presentations


Ads by Google