Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Exam
- {
- class Program
- {
- static void Main(string[] args)
- {
- string inputCurrency = Console.ReadLine();
- double enteredMoney = Double.Parse(Console.ReadLine());
- double xrp = 0.22;
- double btc = 6400;
- double eth = 250;
- bool purchased = true;
- if (inputCurrency != "ETH" && inputCurrency != "XRP" && inputCurrency != "BTC")
- {
- Console.WriteLine($"EUR to {inputCurrency} is not supported!");
- return;
- }
- if (enteredMoney > 1000)
- {
- enteredMoney *= 1.1;
- }
- double purchasedValue = 0;
- if (inputCurrency == "BTC")
- {
- purchasedValue = enteredMoney / btc;
- if (purchasedValue < 0.001)
- {
- Console.WriteLine("Insufficient funds");
- purchased = false;
- }
- if (purchasedValue > 10)
- {
- purchasedValue *= 1.02;
- }
- }
- if (inputCurrency == "ETH")
- {
- purchasedValue = enteredMoney / eth;
- if (purchasedValue < 0.0099)
- {
- Console.WriteLine("Insufficient funds");
- purchased = false;
- }
- }
- if (inputCurrency == "XRP")
- {
- purchasedValue = enteredMoney / xrp;
- if (purchasedValue < 80)
- {
- Console.WriteLine("Insufficient funds");
- purchased = false;
- }
- if (purchasedValue > 1000 && purchasedValue < 2500)
- {
- purchasedValue *= 1.05;
- }
- if (purchasedValue >= 2500)
- {
- purchasedValue *= 1.1;
- }
- }
- if (purchased)
- {
- Console.WriteLine($"Successfully purchased {purchasedValue:f3} {inputCurrency}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement