你如何加上成人加上孩子乘以天数的总价.... [英] How do you add the total price of the adult plus the child multiplyed by the days....

查看:71
本文介绍了你如何加上成人加上孩子乘以天数的总价....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

namespace hotel_project
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            const double price1=70.00;
            const double price2=140.00;
            const double price3=210.00;
            const double price4=280.00;
            const double price5=350.00;


           double  price;
            int days;
            if (listBox1.GetSelected(0))
                price = price1;
            else
                if (listBox1.GetSelected(1))
                    price = price2;
                else
                    if (listBox1.GetSelected(2))
                        price = price3;
                    else
                        if (listBox1.GetSelected(3))
                            price = price4;
                        else
                            price = price5;

                                if (radioButton1.Checked)
                                    days = 1;
                                else
                                    if (radioButton2.Checked)
                                        days = 2;
                                    else
                                        if (radioButton3.Checked)
                                            days = 3;
                                        else
                                            if (radioButton4.Checked)
                                                days = 4;
                                            else
                                                if (radioButton5.Checked)
                                                    days = 5;
                                                else
                                                    if (radioButton6.Checked)
                                                        days = 6;
                                                    else
                                                        days = 7;

            price = price * days ;
            label9.Text = "Total is" + price.ToString("C")

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {

        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void textBox5_TextChanged(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {


        }

        private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}





这是表格截图 http ://i.imgur.com/IwITuVU.png [ ^ ]

推荐答案

这篇关于你如何加上成人加上孩子乘以天数的总价....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆