Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _15.JoroTheFootballPlayer
- {
- using System;
- public class HowManyDaysJoroPlaysFootball
- {
- private const byte WeekendsOnYear = 52;
- public static void Main(string[] args)
- {
- checked
- {
- string typeYear = Console.ReadLine();
- ushort countHolidays = ushort.Parse(Console.ReadLine());
- byte hometownWeekends = byte.Parse(Console.ReadLine());
- // The First we must calculate how many Days in all Weekends Joro playing football:
- double playingDays = CalculatePlayingDaysOfAllWeekends(hometownWeekends);
- // Next we must calculating Playing Days in all Holidays and adds to calculated from Weekends:
- playingDays += countHolidays * 0.5;
- // The Last thing is to Check Year is Leap or not. If Year is Leap adding 3 more days:
- if (typeYear == "t")
- {
- playingDays += 3;
- }
- /* Output must been whole number. Here, we take result, wich is of type double and
- * and casting him to integer: */
- int totalPlayDays = (int)playingDays;
- Console.WriteLine(totalPlayDays);
- }
- }
- private static double CalculatePlayingDaysOfAllWeekends(byte homeWeekends)
- {
- // When Joro goes to hometown, he play 1 day on Weekend:
- double playDays = homeWeekends;
- // Calculate Playing Days from normal Weekends:
- byte countNormalWeekends = (byte)(WeekendsOnYear - homeWeekends);
- playDays += countNormalWeekends * 2 / 3.0;
- return playDays;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement