Advertisement
Guest User

Coffee Machine started

a guest
Apr 6th, 2015
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. int coffee=7; //Needed coffee per drink //
  8. int sugar=3; //Needed sugar per drink //
  9. int stick=1; //Needed stick per drink //
  10. int glass=1; //Needed glass per drink //
  11. bool drink=false; //Drink is ordered or not//
  12. int coquantity=1000; //Started cofee quantity//
  13. int suquantity=1000; //Started sugar quantity//
  14. int stquantity=1000; //Started sticks quantity//
  15. int glquantity=1000; //Started glasses quantity//
  16. int coprice=30; //Price per cofee//
  17. int fivest=5; //Coin of 5 stotinki//
  18. int tenst=10; //Coin of 10 stotinki//
  19. int twentyst=20; //Coin of 20 stotinki//
  20. int fiftyst=50; //Coin of 50 stotinki//
  21. int onelev=100; //Coin of 1 lev //
  22. int wholesum=0; //Whole payed sum
  23. int fivedesk=5; //Desk of 5 stotinki//
  24. int tendesk=10; //Desk of 10 stotinki//
  25. int twentydesk=20; //Desk of 20 stotinki//
  26. int fiftydesk=50; //Desk of 50 stotinki//
  27. int onelevdesk=100; //Desk of 1 lev //
  28. string choice;
  29. string SumStr;
  30. string TempSumStr; //Temporary sum string
  31. int TempSum=0; //Correct Temporary sum
  32. int somesum=0; // Coin which is in
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. do
  40. {
  41. Console.WriteLine ("Искате ли чаша кафе? Натиснете Y за Да и N за Не "); //Here we waitng for his choice
  42. choice=Console.ReadLine(); //His choice is assigned to "choice"//
  43.  
  44. if (choice=="Y")
  45. {
  46. Console.WriteLine ("Благодарим Ви за направеният избор. Моля депозирайте 30 стотинки или повече за да приготвя напитката.");
  47. }
  48. else
  49.  
  50.  
  51. if (choice=="N")
  52. {
  53. Console.WriteLine ("За съжаление днес не предлагаме нищо друго. Помислете пак");
  54. }
  55.  
  56. else if (choice!="Y"||choice!="N")
  57. {
  58. Console.WriteLine ("Моля направете коректен избор.");
  59. }
  60.  
  61. }
  62. while (choice!="Y");
  63. do
  64. {
  65. Console.WriteLine ("Моля въведете стойността на монетата, която пуснахте:");
  66. TempSumStr=Console.ReadLine();
  67. bool isNumber = int.TryParse(TempSumStr, out somesum);
  68. TempSum=(TempSum+somesum);
  69.  
  70. if (!isNumber)
  71. {
  72.  
  73. Console.WriteLine("Говорим за стойност на монети, а не за символи!!");
  74. }
  75.  
  76. else if (TempSum <= coprice)
  77.  
  78. {
  79. Console.WriteLine("Все още не сте внесли достатъчна сума за да пиете от нашето страхотно кафе.");
  80. Console.WriteLine("Моля, пуснете друга монета и въведете стойността и.");
  81. }
  82. }
  83.  
  84. while (coprice>=TempSum);
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement