Untitled
unknown
plain_text
a year ago
1.2 kB
8
Indexable
List<string> currencies = new List<string>()
{
"USD",
"EUR",
"GBP",
"RON",
};
comboBox1.Items.Clear();
comboBox2.Items.Clear();
comboBox1.Items.AddRange(currencies.ToArray());
comboBox2.Items.AddRange(currencies.ToArray());
comboBox1.SelectedItem = "USD";
comboBox2.SelectedItem = "EUR";
string fromCurrency =comboBox1.SelectedItem.ToString();
string toCurrency =comboBox2.SelectedItem.ToString();
double amount;
if(!double.TryParse(textBox1.Text, out amount))
{
MessageBox.Show("Te rog sa introduci o suma valida");
return;
}
double convertedAmount = 0;
if(fromCurrency == "USD" && toCurrency == "EUR")
{
convertedAmount = 0.85 * amount;
}
else if (fromCurrency == "EUR" && toCurrency == "USD")
{
convertedAmount = 1.18 * amount;
}
else if (fromCurrency == "GBP" && toCurrency == "RON")
{
convertedAmount = 5.5 * amount;
}
else if (fromCurrency == "RON" && toCurrency == "GBP")
{
convertedAmount = 0.18 * amount;
}
else if (fromCurrency == "USD" && toCurrency == "RON")
{
convertedAmount = 4.10 * amount;
}
else if(fromCurrency == "RON" && toCurrency == "USD")
{
convertedAmount = 0.24 * amount;
}Editor is loading...
Leave a Comment