Пример #1
0
        public void loadPrices()
        {
            double price;

            reader = File.OpenText("roof_prices.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            part   = Roof.createInstance(price);
            reader.Close();
            reader = File.OpenText("foundation_prices.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            part   = Foundation.createInstance(price);
            reader.Close();
            reader = File.OpenText("siding_prices.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            part   = Siding.createInstance(price);
            reader.Close();
            reader = File.OpenText("door_prices.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            part   = Door.createInstance(price);
            reader.Close();
            reader = File.OpenText("window_prices.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            part   = Window.createInstance(price);
            reader.Close();
            reader = File.OpenText("paint_prices.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            part   = PaintHASS.createInstance(Color.White, price);
            reader.Close();
            reader = File.OpenText("oceanside.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = Oceanside.createInstance(price);
            reader.Close();
            reader = File.OpenText("city.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = City.createInstance(price);
            reader.Close();
            reader = File.OpenText("desert.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = Desert.createInstance(price);
            reader.Close();
            reader = File.OpenText("private_island.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = PrivateIsland.createInstance(price);
            reader.Close();
            reader = File.OpenText("country.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = Country.createInstance(price);
            reader.Close();
            reader = File.OpenText("suburb.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = Suburb.createInstance(price);
            reader.Close();
        }
Пример #2
0
        public void loadPrices()
        {
            double price;

            reader               = File.OpenText("roof_prices.txt");
            price                = Convert.ToDouble(reader.ReadLine());
            part                 = Roof.createInstance(price);
            roofLabel.Text       = part.getPrice().ToString();
            reader               = File.OpenText("foundation_prices.txt");
            price                = Convert.ToDouble(reader.ReadLine());
            part                 = Foundation.createInstance(price);
            foundationLabel.Text = price.ToString();
            reader               = File.OpenText("siding_prices.txt");
            price                = Convert.ToDouble(reader.ReadLine());
            part                 = Siding.createInstance(price);
            sidingLabel.Text     = price.ToString();
            reader               = File.OpenText("door_prices.txt");
            price                = Convert.ToDouble(reader.ReadLine());
            part                 = Door.createInstance(price);
            doorLabel.Text       = price.ToString();
            reader               = File.OpenText("window_prices.txt");
            price                = Convert.ToDouble(reader.ReadLine());
            part                 = Window.createInstance(price);
            windowLabel.Text     = price.ToString();
            reader               = File.OpenText("floor_prices.txt");
            price                = Convert.ToDouble(reader.ReadLine());
            part                 = Floor.createInstance(price);
            floorLabel.Text      = price.ToString();
            reader               = File.OpenText("paint_prices.txt");
            price                = Convert.ToDouble(reader.ReadLine());
            part                 = PaintHASS.createInstance(c, price);
            label8.Text          = price.ToString();
            reader               = File.OpenText("oceanside.txt");
            price                = Convert.ToDouble(reader.ReadLine());
            loc    = Oceanside.createInstance(price);
            reader = File.OpenText("city.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = City.createInstance(price);
            reader = File.OpenText("desert.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = Desert.createInstance(price);
            reader = File.OpenText("private_island.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = PrivateIsland.createInstance(price);
            reader = File.OpenText("country.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = Country.createInstance(price);
            reader = File.OpenText("suburb.txt");
            price  = Convert.ToDouble(reader.ReadLine());
            loc    = Suburb.createInstance(price);
        }
Пример #3
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = listBox1.SelectedIndex;

            switch (index)
            {
            case 0:
                AbsHouseParts part = Roof.createInstance();
                label4.Text = part.getPrice().ToString();
                break;

            case 1:
                part        = Foundation.createInstance();
                label4.Text = part.getPrice().ToString();
                break;

            case 2:
                part        = Siding.createInstance();
                label4.Text = part.getPrice().ToString();
                break;

            case 3:
                part        = Floor.createInstance();
                label4.Text = part.getPrice().ToString();
                break;

            case 4:
                part        = Door.createInstance();
                label4.Text = part.getPrice().ToString();
                break;

            case 5:
                part        = Window.createInstance();
                label4.Text = part.getPrice().ToString();
                break;

            case 6:
                //part = new Paint();
                //label4.Text = part.getPrice().ToString();
                break;
            }
        }