saimun1

Programming basics Exam 18Dec 02. Change Tiles

May 9th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using System;
  2. 2
  3.  
  4. 3
  5. namespace Testing
  6. 4
  7. {
  8. 5
  9.     class MainClass
  10. 6
  11.     {
  12. 7
  13.         public static void Main (string[] args)
  14. 8
  15.  
  16. 9
  17.         {
  18. 10
  19.              
  20. 11
  21.             var money = decimal.Parse (Console.ReadLine ());
  22. 12
  23.             var florWidth = decimal.Parse (Console.ReadLine ());
  24. 13
  25.             var florLength = decimal.Parse (Console.ReadLine ());
  26. 14
  27.             var trianglSide = decimal.Parse (Console.ReadLine ());
  28. 15
  29.             var triangleHigh = decimal.Parse (Console.ReadLine ());
  30. 16
  31.             var blockPrice = decimal.Parse (Console.ReadLine ());
  32. 17
  33.             var priceForWork = decimal.Parse (Console.ReadLine ());
  34. 18
  35.  
  36. 19
  37.             var florArea = florWidth * florLength;
  38. 20
  39.             var blockArea = trianglSide * triangleHigh / 2;
  40. 21
  41.             var blockNeed = Math.Ceiling (florArea / blockArea) + 5;
  42. 22
  43.             //var  blockNeed2 = Math.Ceiling (florArea / blockArea) + 5;
  44. 23
  45.             var totalCost = blockNeed * blockPrice + priceForWork;
  46. 24
  47.             var moneyLeft = money - totalCost;
  48. 25
  49.             if (moneyLeft >= 0) {
  50. 26
  51.                 Console.WriteLine ("{0:f2} lv left.", moneyLeft);
  52. 27
  53.             }
  54. 28
  55.             else {
  56. 29
  57.                
  58. 30
  59.                 Console.WriteLine ("You'll need {0:f2} lv more.", totalCost - money);
  60. 31
  61.  
  62. 32
  63.             }
  64. 33
  65.         }
  66. 34
  67.     }
  68. 35
  69. }
  70. 36
Advertisement
Add Comment
Please, Sign In to add comment