Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Tour_de_France
- {
- class Program
- {
- static void Main()
- {
- int juniors = int.Parse(Console.ReadLine());
- int seniors = int.Parse(Console.ReadLine());
- string roadType = Console.ReadLine();
- double singleJuniorPrice = 0;
- double singleSeniorPrice = 0;
- int allParticipants = juniors + seniors;
- if(roadType == "trail")
- {
- singleJuniorPrice = 5.50;
- singleSeniorPrice = 7;
- }
- else if(roadType == "cross-country")
- {
- singleJuniorPrice = 8;
- singleSeniorPrice = 9.50;
- if(allParticipants >= 50)
- {
- singleJuniorPrice -= singleJuniorPrice * 0.25;
- singleSeniorPrice -= singleSeniorPrice * 0.25;
- }
- }
- else if(roadType == "downhill")
- {
- singleJuniorPrice = 12.25;
- singleSeniorPrice = 13.75;
- }
- else if(roadType == "road")
- {
- singleJuniorPrice = 20;
- singleSeniorPrice = 21.50;
- }
- double totalFromJuniors = juniors * singleJuniorPrice;
- double totalFromSeniors = seniors * singleSeniorPrice;
- double totalAmountBeforeTax = totalFromJuniors + totalFromSeniors;
- double tax = totalAmountBeforeTax * 0.05;
- double totalAfterTax = totalAmountBeforeTax - tax;
- Console.Write("{0:f2}", totalAfterTax);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement