Advertisement
viraco4a

02. Choose a Drink 2.0

May 22nd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ChooseADrink
  5. {
  6. class Program
  7. {
  8. static void Main()
  9. {
  10. var input = Console.ReadLine();
  11. var quantity = int.Parse(Console.ReadLine());
  12. var prices = new Dictionary<string, double>() { { "Water", 0.7 }, { "Coffee", 1.0 }, { "Beer", 1.7 }, { "Tea", 1.2 } };
  13. double totapPrice = 0.0;
  14. switch (input)
  15. {
  16. case "Athlete":
  17. totapPrice = quantity * prices["Water"];
  18. break;
  19. case "SoftUni Student":
  20. totapPrice = quantity * prices["Beer"];
  21. break;
  22. case "Businessman":
  23. case "Businesswoman":
  24. totapPrice = quantity * prices["Coffee"];
  25. break;
  26. default:
  27. totapPrice = quantity * prices["Tea"];
  28. break;
  29. }
  30.  
  31. Console.WriteLine($"The {input} has to pay {totapPrice:F2}.");
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement