Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _03.FootballSouvenirs
- {
- class Program
- {
- static void Main(string[] args)
- {
- string teamName = Console.ReadLine();
- string souvenirs = Console.ReadLine();
- int qty = int.Parse(Console.ReadLine());
- bool isValidCountry = true;
- bool isValidSouvenir = true;
- double totalSum = 0.0;
- switch (teamName)
- {
- case "Argentina":
- switch (souvenirs)
- {
- case "flags":
- totalSum = qty * 3.25;
- break;
- case "caps":
- totalSum = qty * 7.2;
- break;
- case "posters":
- totalSum = qty * 5.1;
- break;
- case "stickers":
- totalSum = qty * 1.25;
- break;
- default:
- isValidSouvenir = false;
- break;
- }
- break;
- case "Brazil":
- switch (souvenirs)
- {
- case "flags":
- totalSum = qty * 4.2;
- break;
- case "caps":
- totalSum = qty * 8.5;
- break;
- case "posters":
- totalSum = qty * 5.35;
- break;
- case "stickers":
- totalSum = qty * 1.2;
- break;
- default:
- isValidSouvenir = false;
- break;
- }
- break;
- case "Croatia":
- switch (souvenirs)
- {
- case "flags":
- totalSum = qty * 2.75;
- break;
- case "caps":
- totalSum = qty * 6.9;
- break;
- case "posters":
- totalSum = qty * 4.95;
- break;
- case "stickers":
- totalSum = qty * 1.1;
- break;
- default:
- isValidSouvenir = false;
- break;
- }
- break;
- case "Denmark":
- switch (souvenirs)
- {
- case "flags":
- totalSum = qty * 3.1;
- break;
- case "caps":
- totalSum = qty * 6.5;
- break;
- case "posters":
- totalSum = qty * 4.8;
- break;
- case "stickers":
- totalSum = qty * 0.9;
- break;
- default:
- isValidSouvenir = false;
- break;
- }
- break;
- default:
- isValidCountry = false;
- break;
- }
- if (isValidCountry && isValidSouvenir)
- {
- Console.WriteLine($"Pepi bought {qty} {souvenirs} of {teamName} for {totalSum:F2} lv.");
- }
- else
- {
- if (!isValidCountry)
- {
- Console.WriteLine("Invalid country!");
- }
- else
- {
- Console.WriteLine("Invalid stock!");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment