Advertisement
dimipan80

Exam 2. Volleyball

Jun 6th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. namespace _1.Volleyball
  2. {
  3.     using System;
  4.  
  5.     public class Volleyball
  6.     {
  7.         private const int WeekendsOnYear = 48;
  8.  
  9.         public static void Main(string[] args)
  10.         {
  11.             checked
  12.             {
  13.                 string year = Console.ReadLine();
  14.                 int holidaysP = int.Parse(Console.ReadLine());
  15.                 int hometownWeekendsH = int.Parse(Console.ReadLine());
  16.  
  17.                 // Calculate playing days of weekends, when Vladi goes at his hometown:
  18.                 double playingDays = hometownWeekendsH;
  19.  
  20.                 // Calculate playing days of normal weekends, when Vladi is not work and adds to calculated result above:
  21.                 playingDays += (WeekendsOnYear - hometownWeekendsH) * 3d / 4d;
  22.  
  23.                 // Calculate playing days of holidays and adds to all calculated result above:
  24.                 playingDays += holidaysP * 2d / 3d;
  25.  
  26.                 // Finally, if given year is Leap, will must addition result with 15%:
  27.                 if (year == "leap")
  28.                 {
  29.                     playingDays *= 1.15;
  30.                 }
  31.  
  32.                 // Rounding to down and print result:
  33.                 int totalPlayDays = (int)playingDays;
  34.                 Console.WriteLine(totalPlayDays);
  35.             }
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement