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 Converter
- {
- class Converter
- {
- private double usd;
- private double eur;
- private double rub;
- private double uah;
- private double usd_coeff = 25.81;
- private double eur_coeff = 28.87;
- private double rub_coeff = 0.40;
- public double Usd
- {
- set
- {
- if(value >= 0) { usd = value; }
- }
- get { return usd; }
- }
- public double Eur
- {
- set
- {
- if (value >= 0) { eur = value; }
- }
- get { return eur; }
- }
- public double Rub
- {
- set
- {
- if (value >= 0) { rub = value; }
- }
- get { return rub; }
- }
- public double Uah
- {
- set
- {
- if (value >= 0) { uah = value; }
- }
- get { return uah; }
- }
- public Converter()
- {
- usd = 0;
- eur = 0;
- rub = 0;
- }
- public Converter(double usd, double eur, double rub)
- {
- usd = usd_coeff * uah;
- eur = eur_coeff * uah;
- rub = rub_coeff * uah;
- }
- public void Switch(int s)
- {
- switch (s)
- {
- case 1:
- Console.WriteLine("Вы выбрали USD");
- break;
- case 2:
- Console.WriteLine("Вы выбрали EUR");
- break;
- case 3:
- Console.WriteLine("Вы выбрали RUB");
- break;
- default:
- Console.WriteLine("Вы выбрали USD");
- break;
- }
- }
- }
- class Program
- {
- static void Main()
- {
- Converter convert = new Converter();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement