Facebook
From Round Pintail, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 248
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp8
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             decimal cenapizzy = 20m;
  14.             Console.WriteLine("Cena podstawowa pizzy to {0}", cenapizzy);
  15.             Console.WriteLine("Jaki chcesz dodatek? Wybierz spośród: pomidor / cebula/ oliwki");
  16.             string dodatek = Console.ReadLine();
  17.             switch (dodatek)
  18.             {
  19.                 case "pomidor":
  20.                     cenapizzy = cenapizzy + 5;
  21.                     Console.WriteLine("Cena z dodatkiem to {0}", cenapizzy);
  22.                     break;
  23.                 case "cebula":
  24.  
  25.                     cenapizzy += 5;
  26.                     Console.WriteLine("Cena z dodatkiem to {0}", cenapizzy);
  27.                     break;
  28.                 case "oliwki":
  29.                     cenapizzy += 9;
  30.                     Console.WriteLine("Cena z dodatkiem to {0}", cenapizzy);
  31.                     break;
  32.                 default:
  33.                     Console.WriteLine("Wybrałeś zły dodatek");
  34.                     break;
  35.             }
  36.             Console.WriteLine("Czy chcesz napoj? (t/n)");
  37.             char wybor = char.Parse(Console.ReadLine());
  38.             switch (wybor)
  39.             {
  40.                 case 't':
  41.                     cenapizzy += 3;
  42.                     Console.WriteLine("Cena pizzy z napojem to {0}", cenapizzy);
  43.                     break;
  44.                 case 'n':
  45.                     Console.WriteLine("Nie wybrałeś napoju");
  46.                     break;
  47.                 default:
  48.                     Console.WriteLine("Wpisałeś złą literkę");
  49.                     break;
  50.             }
  51.             Console.ReadKey();
  52.  
  53.         }
  54.     }
  55. }