ambiorixdr

Voleyball

Oct 17th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 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 Volleyball
  8. {
  9. class Volleyball
  10. {
  11. static void Main(string[] args)
  12. {
  13. string lorn = Console.ReadLine();
  14. double p = int.Parse(Console.ReadLine()); // no need to be double because there can't be 1.5 holiday
  15. double h = int.Parse(Console.ReadLine()); // no need to be double because there can't be 1.5 weekend
  16. double weekendsinSofia = (48 - h) * (3.0 / 4); //it is better to put 3/4 in parentheses for easier readness of the code and 3 to be 3.0 in order to be divided
  17. double playingholidays = (2.0 / 3) * p; // 2 should be 2.0 in order to be divided
  18. double playingresult = weekendsinSofia + playingholidays + h;
  19. if (lorn == "leap")
  20. {
  21. var playingresult1 = (playingresult * 0.15) + playingresult;
  22. Console.WriteLine("{0}", Math.Truncate(playingresult1)); //using Math.Truncate to cut the result as requested
  23. }
  24. else if (lorn == "normal")
  25. {
  26. Console.WriteLine("{0}", Math.Truncate(playingresult)); //using Math.Truncate to cut the result as requested
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment