namespace Task02.App
{
internal class Program
{
static void Main(string[] args)
{
State st = new State();
st.setCountry("Ukrain");
st.setCapital("Kyiv");
st.setPopulatoion(40997699);
st.setplace(603549);
st.setIndependenceDay("24.08.1991");
st.setLanguage("Ukrainian");
State st1 = new State();
st1.setCountry("Bolgaria");
st1.setCapital("Sofia");
st1.setPopulatoion(6519789);
st1.setplace(110993);
st1.setIndependenceDay("22.09.1908");
st1.setLanguage("Bolgarian");
State st2 = new State();
st2.setCountry("Austria");
st2.setCapital("Vienna");
st2.setPopulatoion(8858000);
st2.setplace(83879);
st2.setIndependenceDay("26.10.1955");
st2.setLanguage("German");
State st3 = new State();
st3.setCountry("Moldova");
st3.setCapital("Kishinev");
st3.setPopulatoion(2913281);
st3.setplace(33846);
st3.setIndependenceDay("27.08.1991");
st3.setLanguage("Romanian");
//Console.WriteLine(st.ToText());
//Console.WriteLine(st1.ToText());
// Console.WriteLine(st2.ToText());
// Console.WriteLine(st3.ToText());
st.Print();
st1.Print();
st2.Print();
st3.Print();
}
}
}
using System;
namespace Task02
{
public class State
{
private string capital;
private int place;
private int population;
private string IndependenceDay;
private string language;
private string country;
public string getCountry() {return country; }
public string getCapital() {return capital; }
public string getLanguage(){return language; }
public int getplace(){return place; }
public int getPopulation(){return population; }
public string getIndependenceDay() { return IndependenceDay; }
public void setCountry(string newCountry)
{
if(String.IsNullOrWhiteSpace(newCountry))
Console.ReadKey(false);
country = newCountry;
}
public void setIndependenceDay(string newIndependenceDay)
{
if (String.IsNullOrWhiteSpace(newIndependenceDay))
Console.ReadKey(false);
IndependenceDay = newIndependenceDay;
}
public void setCapital(string newCapital)
{
if (String.IsNullOrWhiteSpace(newCapital))
Console.ReadKey(false);
capital = newCapital;
}
public void setPopulatoion(int newPopulation)
{
if (newPopulation > 0)
population = newPopulation;
}
public void setplace(int newPlace)
{
if (newPlace > 0)
place = newPlace;
}
public void setLanguage(string newLanguage)
{
if (String.IsNullOrWhiteSpace(newLanguage))
Console.ReadKey(false);
language = newLanguage;
}
/*public string ToText()
{
return string.Format("Country: {0}\nstate capital: {1}\nlanguage: {2}\nIndependenceDay: {3}\n" +
"place: {4} km^2\nPopulatoion: {5} humans\n", country, capital, language, IndependenceDay, place, population);
}
*/
public void Print()
{
Console.WriteLine($"Country: {country}\n" +
$"state capital: {capital}\n" +
$"language: {language}\n" +
$"IndependenceDay: {IndependenceDay}\n" +
$"place: {place} km^2\n" +
$"Populatoion: {population} humans\n");
}
}
}