grach

2017_May_07 School Camp

Jan 28th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.44 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _2017_07_May_School_Camp
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string Season = Console.ReadLine();
  14.             string Gender = Console.ReadLine();
  15.             var numberStudents = int.Parse(Console.ReadLine());
  16.             var numberNihts = int.Parse(Console.ReadLine());
  17.  
  18.             var nightPrice = 0.00;
  19.             string sport = string.Empty;
  20.  
  21.  
  22.             switch (Season)
  23.             {
  24.                 case "Winter":
  25.                     {
  26.                         switch (Gender)
  27.                         {
  28.                             case "boys": nightPrice = 9.6; sport = "Judo";break;
  29.                             case "girls": nightPrice = 9.6; sport = "Gymnastics" ; break;
  30.                             case "mixed": nightPrice = 10; sport = "Ski"; break;
  31.                         }
  32.                         break;
  33.                     }
  34.  
  35.                 case "Summer":
  36.                     {
  37.                         switch (Gender)
  38.                         {
  39.                             case "boys": nightPrice = 15; sport = "Football"; break;
  40.                             case "girls": nightPrice = 15; sport = "Volleyball"; break;
  41.                             case "mixed": nightPrice = 20; sport = "Swimming"; break;
  42.                         }
  43.                         break;
  44.                     }
  45.  
  46.                 case "Spring":
  47.                     {
  48.                         switch (Gender)
  49.                         {
  50.                             case "boys": nightPrice = 7.2; sport = "Tennis"; break;
  51.                             case "girls": nightPrice = 7.2; sport = "Athletics"; break;
  52.                             case "mixed": nightPrice = 9.50; sport = "Cicling"; break;
  53.                         }
  54.                         break;
  55.                     }
  56.             }
  57.  
  58.             var total = nightPrice*numberStudents* numberNihts ;
  59.             if (numberStudents>=50)
  60.             {
  61.                total /=2 ; //50% отстъпка/
  62.             }
  63.             else if (numberStudents>=20)
  64.             {
  65.                 total -= total * 0.15;
  66.             }
  67.             else if (numberStudents>=10)
  68.             {
  69.                 total -= total * 0.05;
  70.             }
  71.  
  72.             Console.WriteLine($"{sport} {total:f2} lv.");
  73.  
  74.         }
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment