コード例 #1
0
        public Mic()
        {
            InitializeComponent();
            Microwave mic = new Microwave();

            listBox.Items.Add(mic.pop() + "  Cup popcorn kernels");
            listBox.Items.Add(mic.salt() + "  Teaspoon kosher salt");
            listBox.Items.Add(mic.butter() + "  Tablespoons unsalted butter");
            listBox.Items.Add(mic.cheesef() + "  Tablespoons cheese flavour");
        }
コード例 #2
0
        public void microwave()
        {
            int num;

            if (int.TryParse(numPeople.Text, out num))
            {
                double popcorn = num * 0.25;
                double butter  = num * 2;
                double salt    = num * 0.75;
                double chessef = num * 1;

                Microwave mic = new Microwave(popcorn, butter, salt, chessef);

                this.Hide();
                Mic f3 = new Mic();
                f3.ShowDialog();
            }
            else
            {
                MessageBox.Show("Must be a number", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }