private void button1_Click(object sender, EventArgs e) { travel = (string)comboBox1.SelectedItem; switch (travel) { case RussiaText: if (checkBox1.Checked == false) { Russia r = new Russia(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text), Convert.ToDouble(textBox3.Text)); textBox4.Text = Convert.ToString(r.Calculation()); } else { Russia r = new Russia(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text), Convert.ToDouble(textBox3.Text)); textBox4.Text = Convert.ToString(r.Calculation() + 250); } break; case AbroadText: if (checkBox1.Checked == false) { Abroad a = new Abroad(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text), Convert.ToDouble(textBox3.Text)); textBox4.Text = Convert.ToString(a.Calculation()); } else { Abroad a = new Abroad(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text), Convert.ToDouble(textBox3.Text)); textBox4.Text = Convert.ToString(a.Calculation() + 250); } break; } }
static void Main(string[] args) { Country one = new Country("Россия", 145_000_000); Russia two = new Russia(11288.87, "69"); Ukraine three = new Ukraine(443, "Киев"); //Country Console.WriteLine("Информация из класса Country:" + "\n"); Console.WriteLine("Название страны: " + one.Name); Console.WriteLine("Население: " + one.Population); one.ChangeCountryName("Украина"); one.ChangePopulationValue(42_000_000); Console.WriteLine(); Console.WriteLine("Название страны: " + one.Name); Console.WriteLine("Население: " + one.Population); Console.WriteLine(); one.PrintCountryInfo(); Console.WriteLine("///////////////////////////////////////"); //Russia Console.WriteLine("Информация из класса Russia:" + "\n"); Console.WriteLine("ВВП на душу населения: " + two.VVP); Console.WriteLine("Стоимость рубля: " + two.RubleValueToUSD); Console.WriteLine(); two.PrintRussiaInfo(); two.MakeNuclearStrike("Польша"); two.isChinaFriendToRussia(true); Console.WriteLine("///////////////////////////////////////"); //Ukraine Console.WriteLine("Информация из класса Ukraine:" + "\n"); Console.WriteLine("Количество городов Украины: " + three.NumberOfCities); Console.WriteLine("Столица Украины: " + three.Capital); Console.WriteLine(); three.MakeBuisness(500_367); Console.WriteLine(); three.ToStoleSomething("шоколад"); Console.WriteLine(); three.AreYouPresident(false); Console.WriteLine(); }
static void Main(string[] args) { Russia c1 = new Russia(); c1.Prn(); USA c2 = new USA(); c2.Prn(); France c3 = new France(); c3.Prn(); double p1, p2, p3; p1 = c1.GetPopolation(); p2 = c2.GetPopolation(); p3 = c3.GetPopolation(); double max; max = 0; if (p1 > p2 && p1 > p3) { max = p1; Console.WriteLine($"Столица с наибольшим населением - {max} - Москва"); } if (p2 > p1 && p2 > p3) { max = p2; Console.WriteLine($"Столица с наибольшим населением - {max} - Вашингтон"); } if (p3 > p2 && p3 > p1) { max = p3; Console.WriteLine($"Столица с наибольшим населением - {max} - Париж"); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Russia obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Russia obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public void AddClient() { Console.Write("Username: "******"Password: "******"First name: "); string firstName = Console.ReadLine(); Console.Write("Last name: "); string lastName = Console.ReadLine(); Console.Write("Email: "); string email = Console.ReadLine(); Console.Write("Phone number: "); string phoneNumber = Console.ReadLine(); Console.Write("Age: "); int age = int.Parse(Console.ReadLine()); Console.Write("Gender: "); GenderType gender = (GenderType)Enum.Parse(typeof(GenderType), Console.ReadLine()); Console.WriteLine("--- Address ---"); Console.Write("Country: "); string countryString = Console.ReadLine(); Country country; switch ((CountryType)Enum.Parse(typeof(CountryType), countryString)) { case CountryType.Bulgaria: country = new Bulgaria(); break; case CountryType.Serbia: country = new Serbia(); break; case CountryType.Russia: country = new Russia(); break; default: throw new ArgumentException("We don't ship to this country yet!"); } Console.Write("City: "); string city = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Red; Validator.ValidateCityInCountry(city, country, Constants.NoSuchCity); Console.ResetColor(); Console.Write("Street name: "); string streetName = Console.ReadLine(); Console.Write("Street number: "); string streetNumber = Console.ReadLine(); Address userAddress = new Address(country, streetName, streetNumber, city); var isUserPresent = this.Users .FirstOrDefault(u => u.Username.Equals(username)); if (isUserPresent != null) { throw new ArgumentException(string.Format( Constants.UserAlreadyExists, isUserPresent.GetType().Name, isUserPresent.Username)); } var client = this.Factory.CreateClient(username, password, firstName, lastName, email, age, phoneNumber, userAddress, gender); this.Users.Add(client); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(Constants.RegisteredClient, client.Username); Console.ResetColor(); }