madeofglass

Untitled

Feb 24th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02.LunchBreak
  4. {
  5.     class LunchBreak
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string nameTVshow = Console.ReadLine();
  10.             double timeEpisode = double.Parse(Console.ReadLine());
  11.             double breakTime = double.Parse(Console.ReadLine());
  12.  
  13.             double lunch = breakTime / 8;
  14.             double rest = breakTime / 4;
  15.             double allBreak = lunch + rest + timeEpisode;
  16.             double difference = Math.Abs(breakTime - allBreak);
  17.  
  18.             if (breakTime >= allBreak)
  19.             {
  20.                 Console.WriteLine($"You have enough time to watch " +
  21.                     $"{nameTVshow} and left with {Math.Ceiling(difference)} minutes free time.");
  22.             }
  23.             else
  24.             {
  25.                 Console.WriteLine($"You don't have enough time to watch " +
  26.                     $"{nameTVshow}, you need {Math.Ceiling(difference)} more minutes.");
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment