门票销售计算器
来源:互联网 发布:vscode ripgrep 编辑:程序博客网 时间:2024/04/18 07:40
我只是个初学者而已。
===========================
1.门票类型的选择:成人票,儿童票,打折票。
2.选择打折票的时候执行3种打折方式:9折,8折,6.5折。
3.选择门票类型时,给出相应的票价。
4.根据打折程度,显示票价。
5.允许输入购票数量。
6.根据购票数量,自动计算应付款,并显示(购票数*票价=应付款)
7.允许输入当前预付购票款
8.自动计算显示找零。
9.打折票默认为9折。
=====================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ticket
{
public partial class Form1 : Form
{
private const double CommonPrice = 45.00;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void radioButton1_Click(object sender, EventArgs e)
{
Price_textBox.Text = string.Format("{0:f2}", CommonPrice * 90 / 100);
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
Price_textBox.Text = string.Format("{0:f2}", CommonPrice * 80/ 100);
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
Price_textBox.Text = string.Format("{0:f2}", CommonPrice * 65/ 100);
}
private void ticket_type_ComboBOX_SelectedValueChanged(object sender, EventArgs e)
{
//开启购票数量与购票款输入功能
total_ticket_textBox.ReadOnly = false;
patment_textBox.ReadOnly=false;
//清空“应收款”,“找零“显示内容
receiving_textBox.Text = "";
balance_textBox.Text = "";
//设置折扣不可用
discount_groupBox.Enabled = false;
//判断当前选择票的类型
switch(ticket_type_ComboBOX.SelectedIndex)
{
case 0:
Price_textBox.Text = string.Format("{0:f2}", CommonPrice);
break;
case 1:
Price_textBox.Text = string.Format("{0:f2}", CommonPrice * 50 / 100);
break;
case 2:
discount_groupBox.Enabled=true;
radioButton1.Checked = true;
Price_textBox.Text = string.Format("{0:f2}", CommonPrice * 90 / 100);
break;
}
}
private void button1_Click(object sender, EventArgs e)
{
double payment, receiving, price,balance;
int tickets;
try
{
tickets = Int32.Parse(total_ticket_textBox.Text);
payment = double.Parse(patment_textBox.Text);
price = double.Parse(Price_textBox.Text);
//计算应该收款并输出
receiving = tickets * price;
receiving_textBox.Text = string.Format("{0:f2}", receiving);
//计算并输出找零
balance = payment - receiving;
balance_textBox.Text = string.Format("{0:f2}", balance);
}
catch
{
MessageBox.Show("输入有错误!请检查购票类型,折扣。数量与应付款");
return;
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
- 门票销售计算器
- C# 门票销售器
- 北京奥运门票销售4月启动(票价一览表)
- 成佩涛——免费门票销售和报名收费平台
- 门票
- 奥运门票因技术原因暂停销售 11月5日将公布新办法
- 使用synchronized关键字解决共享数据同步问题:多线程门票销售
- Tech•Ed 2010(中国)微软技术大会使用mymova进行门票销售与会议推广服务
- 景点门票
- 销售
- 销售
- 销售
- 销售
- 销售
- 销售
- 计算器
- 计算器
- /* 计算器 */
- 找合适自己的东西难
- 职场“十不要”,让你少奋斗30年!
- 破解路由器密码
- Flex翻书效果
- Flex渲染器的用法
- 门票销售计算器
- MySQL Master/Slave Server 架设
- 锁相环PLL原理 && 时钟产生方法
- 第三章 内核对象
- 漫谈如何学习操作系统原理(转载)
- 英汉词典&英英词典
- Hibernate配置問題: could not execute query
- Test
- JAVA连接池,全的哦