Last active
October 18, 2022 12:31
-
-
Save Velsimir/26a2ffdc8b6e7832db666a2204d3b6bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Security.Policy; | |
namespace iJunior | |
{ | |
class MainClass | |
{ | |
public static void Main(string[] args) | |
{ | |
float rubBalance = 1000; | |
float usdBalance = 1000; | |
float euroBalance = 1000; | |
float rubleToDollarExchangeRate = 59.9f; | |
float rubleToEuroExchangeRate = 60.9f; | |
float dollarToEuroExchangeRate = 0.9f; | |
float dollarToRubleExchangeRate = 0.016f; | |
float euroToRubleExchangeRate = 0.016f; | |
float euroToDollarExchangeRate = 0.9f; | |
int choseRuble = 1; | |
int choseDollar = 2; | |
int choseEuro = 3; | |
int choseExit = 0; | |
int amountOfMoney; | |
int userInput; | |
bool userChoose = true; | |
while (userChoose) | |
{ | |
Console.WriteLine($" Ваш баланс на текущий момент: " + | |
$"\n\n Рубли = {rubBalance} " + | |
$"\n Доллары = {usdBalance}" + | |
$"\n Евро = {euroBalance}"); | |
Console.WriteLine(); | |
Console.WriteLine($"Выбирете валюту с которой хотите выполнить операцию: " + | |
$"\n Рубли - {choseRuble} " + | |
$"\n Доллоры - {choseDollar} " + | |
$"\n Евро - {choseEuro}" + | |
$"\n Выйти из конвертера - {choseExit}"); | |
userInput = Convert.ToInt32(Console.ReadLine()); | |
Console.Clear(); | |
switch (userInput) | |
{ | |
case 1: | |
Console.WriteLine($"Выбирете валюту для конвертации: " + | |
$"\n Доллоры - {choseDollar}" + | |
$"\n Евро - {choseEuro}"); | |
userInput = Convert.ToInt32(Console.ReadLine()); | |
switch (userInput) | |
{ | |
case 2: | |
Console.WriteLine("Производится обмен рублей в доллоры"); | |
Console.WriteLine(); | |
Console.Write("Какую сумму вы хотите обменять?"); | |
amountOfMoney = Convert.ToInt32(Console.ReadLine()); | |
if (amountOfMoney > rubBalance) | |
{ | |
Console.WriteLine("У вас на счету недостаточно средств"); | |
} | |
else | |
{ | |
rubBalance -= amountOfMoney; | |
usdBalance += amountOfMoney * dollarToRubleExchangeRate; | |
} | |
break; | |
case 3: | |
Console.WriteLine("Производится обмен рублей в евро"); | |
Console.WriteLine(); | |
Console.Write("Какую сумму вы хотите обменять?"); | |
amountOfMoney = Convert.ToInt32(Console.ReadLine()); | |
if (amountOfMoney > rubBalance) | |
{ | |
Console.WriteLine("У вас на счету недостаточно средств"); | |
} | |
else | |
{ | |
rubBalance -= amountOfMoney; | |
euroBalance += amountOfMoney * euroToRubleExchangeRate; | |
} | |
break; | |
} | |
break; | |
case 2: | |
Console.WriteLine($"Выбирете валюту для конвертации " + | |
$"\n Рубли - {choseRuble}" + | |
$"\n Евро - {choseEuro}"); | |
userInput = Convert.ToInt32(Console.ReadLine()); | |
switch (userInput) | |
{ | |
case 1: | |
Console.WriteLine("Производится обмен доллоров в рубли"); | |
Console.WriteLine(); | |
Console.Write("Какую сумму вы хотите обменять?"); | |
amountOfMoney = Convert.ToInt32(Console.ReadLine()); | |
if (amountOfMoney > usdBalance) | |
{ | |
Console.WriteLine("У вас на счету недостаточно средств"); | |
} | |
else | |
{ | |
usdBalance -= amountOfMoney; | |
rubBalance += amountOfMoney * rubleToDollarExchangeRate; | |
} | |
break; | |
case 3: | |
Console.WriteLine("Производится обмен доллоров в евро"); | |
Console.WriteLine(); | |
Console.Write("Какую сумму вы хотите обменять?"); | |
amountOfMoney = Convert.ToInt32(Console.ReadLine()); | |
if (amountOfMoney > usdBalance) | |
{ | |
Console.WriteLine("У вас на счету недостаточно средств"); | |
} | |
else | |
{ | |
usdBalance -= amountOfMoney; | |
euroBalance += amountOfMoney * euroToDollarExchangeRate; | |
} | |
break; | |
} | |
break; | |
case 3: | |
Console.WriteLine($"Выбирете валюту для конвертации " + | |
$"\n Рубли - {choseRuble}" + | |
$"\n Доллоры - {choseDollar}"); | |
userInput = Convert.ToInt32(Console.ReadLine()); | |
switch (userInput) | |
{ | |
case 1: | |
Console.WriteLine("Производится обмен евро в рубли"); | |
Console.WriteLine(); | |
Console.Write("Какую сумму вы хотите обменять?"); | |
amountOfMoney = Convert.ToInt32(Console.ReadLine()); | |
if (amountOfMoney > euroBalance) | |
{ | |
Console.WriteLine("У вас на счету недостаточно средств"); | |
} | |
else | |
{ | |
euroBalance -= amountOfMoney; | |
rubBalance += amountOfMoney * rubleToEuroExchangeRate; | |
} | |
break; | |
case 3: | |
Console.WriteLine("Производится обмен евро в доллоры"); | |
Console.WriteLine(); | |
Console.Write("Какую сумму вы хотите обменять?"); | |
amountOfMoney = Convert.ToInt32(Console.ReadLine()); | |
if (amountOfMoney > euroBalance) | |
{ | |
Console.WriteLine("У вас на счету недостаточно средств"); | |
} | |
else | |
{ | |
euroBalance -= amountOfMoney; | |
usdBalance += amountOfMoney * dollarToEuroExchangeRate; | |
} | |
break; | |
} | |
break; | |
case 0: | |
userChoose = false; | |
break; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment