Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 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 ConsoleApp16
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. decimal cenapizzy = 20m;
  14.  
  15. Console.WriteLine("Cena podstawowa pizzy {0}", cenapizzy);
  16. Console.WriteLine("Wybierz dodatek do pizzy: pomidor/cebula/oliwki");
  17.  
  18. string dodatek = Console.ReadLine();
  19. switch (dodatek)
  20. {
  21. case "pomidor":
  22. cenapizzy = cenapizzy + 5;
  23. Console.WriteLine("Cena pizzy z dodatkiem to {0}", cenapizzy);
  24. break;
  25. case "cebula":
  26. cenapizzy = cenapizzy + 5;
  27. Console.WriteLine("Cena pizzy z dodatkiem to {0}", cenapizzy);
  28. break;
  29. case "oliwki":
  30. cenapizzy = cenapizzy + 5;
  31. Console.WriteLine("Cena pizzy z dodatkiem to {0}", cenapizzy);
  32. break;
  33. default:
  34. Console.WriteLine("Nie ma takiego dodatku");
  35. break;
  36.  
  37.  
  38. }
  39. Console.WriteLine("Czy chcesz napój (t/n)");
  40. char odpowiedz = char.Parse(Console.ReadLine());
  41.  
  42. switch (odpowiedz)
  43. {
  44. case 't':
  45. cenapizzy += 3;
  46. Console.WriteLine("Cena pizzy z napojem to {0}", cenapizzy);
  47. break;
  48. case 'n':
  49. Console.WriteLine("Nie wybrałeś napoju");
  50. break;
  51. default:
  52. Console.WriteLine("Wpisałeś złą literę");
  53. break;
  54.  
  55.  
  56. }
  57. Console.ReadLine();
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement