Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://judge.softuni.bg/Contests/Practice/Index/368#0
- using System;
- namespace Testing
- {
- class MainClass
- {
- public static void Main (string[] args)
- {
- int chrys = int.Parse (Console.ReadLine ());
- int roses = int.Parse (Console.ReadLine ());
- int tulip = int.Parse (Console.ReadLine ());
- string season = Console.ReadLine ();
- string holidayCheck = Console.ReadLine ();
- float hrizPr = 0f;
- float rosesPr = 0f;
- float tulipPr = 0f;
- float secondDiscount = 1f;
- var totalFlowers = chrys + roses + tulip;
- float discountPrc =0;
- if (season == "Spring" || season == "Summer") {
- hrizPr = 2.0f * chrys;
- rosesPr = 4.1f * roses;
- tulipPr = 2.5f * tulip;
- }
- if (season == "Winter" || season == "Autumn") {
- hrizPr = 3.75f * chrys;
- rosesPr = 4.50f * roses;
- tulipPr = 4.15f * tulip;
- }
- if (season == "Winter" && roses >= 10) {
- discountPrc += 0.10f;
- }
- if(season == "Spring" && tulip >7) {
- discountPrc = discountPrc + 0.05f;
- }
- if (totalFlowers > 20) {
- secondDiscount -= 0.2f;
- }
- float totalPrice = rosesPr + tulipPr+hrizPr;
- //Console.WriteLine (totalPrice);
- if (holidayCheck == "Y") {
- totalPrice = totalPrice * 1.15f;
- //Console.WriteLine (totalPrice);
- }
- var discount = 1 - discountPrc;
- //Console.WriteLine (discountPrc);
- totalPrice *= discount;
- totalPrice *= secondDiscount;
- Console.WriteLine ("{0:f2}",totalPrice +2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment