Пример #1
0
        public MyWindow()
        {
            InitializeComponent();
            MyPark = new ParkOfCars();
            MyPark.AddSimpleCar("ladasedan", "м371ак", 400000, 7, 175);
            MyPark.AddGoodCar("subaru_forester", "н136ор", 1800000, 8, 198);
            MyPark.AddVIPCar("mers_cls", "е777кх", 5000000, 5, 250);

            Cost_label.Content = null;
            Cost_label.Content = MyPark.GetCost();
        }
Пример #2
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            string Name   = NameTextBox.Text;
            string Number = NumberTextBox.Text;
            int    Price  = Convert.ToInt32(PriceTextBox.Text);
            int    Fuel   = Convert.ToInt32(FuelTextBox.Text);
            int    Speed  = Convert.ToInt32(SpeedTextBox.Text);

            if (SimpleCarRBut.IsChecked == true)
            {
                MyPark.AddSimpleCar(Name, Number, Price, Fuel, Speed);
            }
            else if (GoodCarRBut.IsChecked == true)
            {
                MyPark.AddGoodCar(Name, Number, Price, Fuel, Speed);
            }
            else
            {
                MyPark.AddVIPCar(Name, Number, Price, Fuel, Speed);
            }
        }