Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Volleyball
- {
- class Volleyball
- {
- static void Main(string[] args)
- {
- string lorn = Console.ReadLine();
- double p = int.Parse(Console.ReadLine()); // no need to be double because there can't be 1.5 holiday
- double h = int.Parse(Console.ReadLine()); // no need to be double because there can't be 1.5 weekend
- 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
- double playingholidays = (2.0 / 3) * p; // 2 should be 2.0 in order to be divided
- double playingresult = weekendsinSofia + playingholidays + h;
- if (lorn == "leap")
- {
- var playingresult1 = (playingresult * 0.15) + playingresult;
- Console.WriteLine("{0}", Math.Truncate(playingresult1)); //using Math.Truncate to cut the result as requested
- }
- else if (lorn == "normal")
- {
- Console.WriteLine("{0}", Math.Truncate(playingresult)); //using Math.Truncate to cut the result as requested
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment