Advertisement
nevenailievaa

06.FootballSouvenirs

Nov 19th, 2022
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.40 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp4
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //INPUT
  10.             string team = Console.ReadLine();
  11.             string typeSouvenirs = Console.ReadLine();
  12.             int numberBoughtSouvenirs = int.Parse(Console.ReadLine());
  13.             double price = 0;
  14.  
  15.             //CALCULATIONS
  16.             //Argentina
  17.             if (team == "Argentina")
  18.             {
  19.                 if (typeSouvenirs == "flags")
  20.                 {
  21.                     price = 3.25;
  22.                 }
  23.                 else if (typeSouvenirs == "caps")
  24.                 {
  25.                     price = 7.20;
  26.                 }
  27.                 else if (typeSouvenirs == "posters")
  28.                 {
  29.                     price = 5.10;
  30.                 }
  31.                 else if (typeSouvenirs == "stickers")
  32.                 {
  33.                     price = 1.25;
  34.                 }
  35.             }
  36.             //Brasil
  37.             else if (team == "Brazil")
  38.             {
  39.                 if (typeSouvenirs == "flags")
  40.                 {
  41.                     price = 4.20;
  42.                 }
  43.                 else if (typeSouvenirs == "caps")
  44.                 {
  45.                     price = 8.50;
  46.                 }
  47.                 else if (typeSouvenirs == "posters")
  48.                 {
  49.                     price = 5.35;
  50.                 }
  51.                 else if (typeSouvenirs == "stickers")
  52.                 {
  53.                     price = 1.20;
  54.                 }
  55.             }
  56.             //Croatia
  57.             else if (team == "Croatia")
  58.             {
  59.                 if (typeSouvenirs == "flags")
  60.                 {
  61.                     price = 2.75;
  62.                 }
  63.                 else if (typeSouvenirs == "caps")
  64.                 {
  65.                     price = 6.90;
  66.                 }
  67.                 else if (typeSouvenirs == "posters")
  68.                 {
  69.                     price = 4.95;
  70.                 }
  71.                 else if (typeSouvenirs == "stickers")
  72.                 {
  73.                     price = 1.10;
  74.                 }
  75.             }
  76.             //Denmark
  77.             else if (team == "Denmark")
  78.             {
  79.                 if (typeSouvenirs == "flags")
  80.                 {
  81.                     price = 3.10;
  82.                 }
  83.                 else if (typeSouvenirs == "caps")
  84.                 {
  85.                     price = 6.50;
  86.                 }
  87.                 else if (typeSouvenirs == "posters")
  88.                 {
  89.                     price = 4.80;
  90.                 }
  91.                 else if (typeSouvenirs == "stickers")
  92.                 {
  93.                     price = 0.90;
  94.                 }
  95.             }
  96.  
  97.             double sum = numberBoughtSouvenirs * price;
  98.  
  99.             //OUTPUT
  100.             if (team != "Argentina" && team != "Brazil" && team != "Croatia" && team != "Denmark")
  101.             {
  102.                 Console.WriteLine("Invalid country!");
  103.                 return;
  104.             }
  105.             if (typeSouvenirs != "caps" && typeSouvenirs != "flags" && typeSouvenirs != "posters" && typeSouvenirs != "stickers")
  106.             {
  107.                 Console.WriteLine($"Invalid stock!");
  108.                 return;
  109.             }
  110.             else
  111.             {
  112.                 Console.WriteLine($"Pepi bought {numberBoughtSouvenirs} {typeSouvenirs} of {team} for {sum:f2} lv.");
  113.             }
  114.         }
  115.     }
  116. }
  117.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement