Advertisement
IskandarIts

Untitled

Feb 20th, 2021
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. class Money
  2.     {
  3.         public int first { get; set; }
  4.         public int second { get; set; }
  5.  
  6.         public Money(int f, int s)
  7.         {
  8.             first = f;
  9.             second = s;
  10.         }
  11.  
  12.         public int All_money()
  13.         {
  14.             return first * second;
  15.         }
  16.  
  17.         public bool Enough_Money(int n)
  18.         {
  19.             if (All_money() >= n)
  20.                 return true;
  21.             return false;
  22.         }
  23.     }
  24.  
  25. //Money m = new Money(500, 3);
  26.         //Console.WriteLine(String.Format("Номинал = {0} рублей, количество = {1}, общая сумма = {2} рублей", m.first, m.second, m.All_money()));
  27.  
  28.         //Console.WriteLine("Введите стоимость товара");
  29.         //int n = Convert.ToInt32(Console.ReadLine());
  30.  
  31.         //if (m.Enough_Money(n))
  32.         //    Console.WriteLine(String.Format("Денег хватит на покупку товара стоимостью {0} рублей." +
  33.         //        "\nУ вас останется {1} рублей", n, m.All_money() - n));
  34.         //else
  35.         //    Console.WriteLine(String.Format("Вам не хватает {0}", n - m.All_money()));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement