Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Converter
  8. {
  9. class Converter
  10. {
  11. private double usd;
  12. private double eur;
  13. private double rub;
  14. private double uah;
  15.  
  16. private double usd_coeff = 25.81;
  17. private double eur_coeff = 28.87;
  18. private double rub_coeff = 0.40;
  19.  
  20. public double Usd
  21. {
  22. set
  23. {
  24. if(value >= 0) { usd = value; }
  25. }
  26. get { return usd; }
  27. }
  28.  
  29. public double Eur
  30. {
  31. set
  32. {
  33. if (value >= 0) { eur = value; }
  34. }
  35. get { return eur; }
  36. }
  37.  
  38. public double Rub
  39. {
  40. set
  41. {
  42. if (value >= 0) { rub = value; }
  43. }
  44. get { return rub; }
  45. }
  46.  
  47. public double Uah
  48. {
  49. set
  50. {
  51. if (value >= 0) { uah = value; }
  52. }
  53. get { return uah; }
  54. }
  55.  
  56. public Converter()
  57. {
  58. usd = 0;
  59. eur = 0;
  60. rub = 0;
  61. }
  62.  
  63. public Converter(double usd, double eur, double rub)
  64. {
  65. usd = usd_coeff * uah;
  66. eur = eur_coeff * uah;
  67. rub = rub_coeff * uah;
  68. }
  69.  
  70. public void Switch(int s)
  71. {
  72. switch (s)
  73. {
  74. case 1:
  75. Console.WriteLine("Вы выбрали USD");
  76. break;
  77. case 2:
  78. Console.WriteLine("Вы выбрали EUR");
  79. break;
  80. case 3:
  81. Console.WriteLine("Вы выбрали RUB");
  82. break;
  83. default:
  84. Console.WriteLine("Вы выбрали USD");
  85. break;
  86. }
  87. }
  88. }
  89.  
  90. class Program
  91. {
  92. static void Main()
  93. {
  94. Converter convert = new Converter();
  95. Console.ReadKey();
  96. }
  97. }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement