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(); }
static void Main(string[] args) { ParkOfCars MyPark = new ParkOfCars(); while (true) { Console.WriteLine("1 - Add car, 2 - GetCost, 3 - Sort, 4 = FindCar"); int Action = Convert.ToInt32(Console.ReadLine()); switch (Action) { case 1: Console.WriteLine("Name: "); string name = Console.ReadLine(); Console.WriteLine("Number: "); string number = Console.ReadLine(); Console.WriteLine("Price: "); int price = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("FuelConsumption: "); int fuelconsumption = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Speed: "); int speed = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("1 - VIP, 2 - Good, 3 - Simple"); int TypCar = Convert.ToInt32(Console.ReadLine()); switch (TypCar) { case 1: MyPark.AddVIPCar(name, number, price, fuelconsumption, speed); break; case 2: MyPark.AddSimpleCar(name, number, price, fuelconsumption, speed); break; case 3: MyPark.AddSimpleCar(name, number, price, fuelconsumption, speed); break; default: Console.WriteLine("adding error"); break; } break; case 2: Console.WriteLine(MyPark.GetCost()); break; case 3: Console.WriteLine(MyPark.GetSortedCars()); break; case 4: Console.WriteLine("min"); int min = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("max"); int max = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(MyPark.GetSpeedCar(min, max)); break; } } }
private void Show_price_Click(object sender, RoutedEventArgs e) { Cost_label.Content = MyPark.GetCost(); }