Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Can you fix my code?

$
0
0
I need help with my code. I have alot of errors and I dont know how to fix it. its greatly appreciated if you can help. Thanks in advance for answering and reading this question.

The code is pretty self explanatory on what I am trying to accomplish.

My errors:

These are my errors:
The type "WindowsFormApplication1.order already contains a definition 
for the following words:

Wateryum
TradeInn
SubtotalPlz
piece24
piece12
Desert



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 WindowsFormsApplication1
{
    public partial class order : Form
    {
        public order()
        {
            InitializeComponent();
        }
        //variable dictionary
        //piece24 is the name for a chicken bucket of 24 pieces
        //piece12 is the name for a chicken bucket of 12 pieces
        //CokePepsi is the name for a beverage for Coke and pepsi
        //Wateryum is the name for a beverage for a bottled water
        //Desert is the name of a desert for a southern pie
        //total is the calculated total price
        //Subtotalplz is the calculated subtotal
        //salestax is the tax added to the bill
        //TradeInn is calculated with the order
        //packageprice is calculated with the order, determines the price for the package for the food
        //baseprice is the baseprice for each food item on sale
        //Welcome is the main form of the program
        //Order is the form where you order food items and your orders are calculated into a bill.

        //declaring global variables
        double piece24;
        double piece12;
        double CokePepsi;
        double Wateryum;
        double Desert;
        double Total;
        double SubtotalPlz;
        double salestax;
        double totalprice;
        double TradeInn;
        double packageprice;
        double baseprice;
     
       
        private void order_Load(object sender, EventArgs e)
       { 
            //changing background colour
            this.BackColor = System.Drawing.Color.Red;

            //setting prices
                piece12 = 1299;
                piece24 = 2199;
                double beverages = 199;
                desert = 299;
                TotalLbl.Text = "0";
                baseprice = 0;
                packageprice = 0;
                TradeInn.Text = "0";

        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        { //display prices
            BasePrice.Text = piece12.ToString("c");
            BasePrice = piece12;
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        { 
            //display prices
            BasePrice.Text = piece24.ToString("c");
            BasePrice.Text = piece24;
        }

        private void radioButton6_CheckedChanged(object sender, EventArgs e)
        {
            //display prices
            BasePrice.Text = Desert.ToString("c");
            BasePrice.Text = Desert;
        }

        private void radioButton4_CheckedChanged(object sender, EventArgs e)
        {
            //display prices
            BasePrice.Text = Wateryum.ToString("c");
            BasePrice.Text = Wateryum;
        }

        private void Calculate_Click(object sender, EventArgs e)
        {
            //Calculating prices
            TradeInn = double.Parse(TradeInn.Text);
            SubtotalPlz = BasePrice + PackagePrice - TradeInn;
            salestax = SubtotalPlz * 0.14;
            totalprice = SubtotalPlz + salestax;

            TradeInn.Text = TradeInn.ToString("c");
            SubtotalPlz.Text = SubtotalPlz.ToString("c");
            salestaxx.Text = salestax.ToString("c");
            TotalLbl.Text = Total.ToString("c");
        }

        private void radioButton5_CheckedChanged(object sender, EventArgs e)
        {
            //display prices
            BasePrice.Text = CokePepsi.ToString("c");
            BasePrice.Text = CokePepsi.ToString("c");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            //Clearing previous entries
            BasePrice.Text = "";
            PackagePrice.Text = "";
            salestaxx.Text = "";
            SubtotalPlz.Text = "";
            TradeInn.Text = "";
            Total.Text = "";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //Opens up a new form, and closes the one you currently are on.
            Welcome.Show;
            order.close;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            //Closes the form you currently are on.
            this.Close();
        }


      
    }
}

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>