Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05.Series
- {
- class Series
- {
- static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- double TVshowsNum = double.Parse(Console.ReadLine());
- double priceAll = 0.0;
- for (int i = 1; i <= TVshowsNum; i++)
- {
- string nameTVshow = Console.ReadLine();
- double pricePerTVshow = double.Parse(Console.ReadLine());
- if (nameTVshow == "Thrones")
- {
- pricePerTVshow = pricePerTVshow * 0.50;
- }
- else if (nameTVshow == "Lucifer")
- {
- pricePerTVshow = pricePerTVshow * 0.60;
- }
- else if (nameTVshow == "Protector")
- {
- pricePerTVshow = pricePerTVshow * 0.70;
- }
- else if (nameTVshow == "TotalDrama")
- {
- pricePerTVshow = pricePerTVshow * 0.80;
- }
- else if (nameTVshow == "Area")
- {
- pricePerTVshow = pricePerTVshow * 0.90;
- }
- priceAll += pricePerTVshow;
- }
- double difference = Math.Abs(budget - priceAll);
- if (budget >= priceAll)
- {
- Console.WriteLine($"You bought all the series and " +
- $"left with {difference:f2} lv.");
- }
- else
- {
- Console.WriteLine($"You need {difference:f2} lv. more to buy the series!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement