Advertisement
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 Bike_Race
- {
- class Program
- {
- static void Main(string[] args)
- {
- int juniors = int.Parse(Console.ReadLine());
- int seniors = int.Parse(Console.ReadLine());
- string trace = Console.ReadLine();
- double seniorProfit = 0;
- double juniorProfit = 0;
- int totalRacers = juniors + seniors;
- double totalProfit = 0;
- if (trace == "trail")
- {
- juniorProfit = juniors * 5.50;
- seniorProfit = seniors * 7;
- }
- else if (trace == "cross-country")
- {
- if (totalRacers >= 50)
- {
- juniorProfit = (juniors * 8) - juniors * 8 * 0.25;
- seniorProfit = (seniors * 9.50) - seniors * 9.50 * 0.25;
- }
- else
- {
- juniorProfit = juniors * 8;
- seniorProfit = seniors * 9.50;
- }
- }
- else if (trace == "downhill")
- {
- juniorProfit = juniors * 12.25;
- seniorProfit = seniors * 13.75;
- }
- else if (trace == "road")
- {
- juniorProfit = juniors * 20;
- seniorProfit = seniors * 21.50;
- }
- totalProfit = (juniorProfit + seniorProfit) - ((juniorProfit + seniorProfit) * 0.05);
- Console.WriteLine($"{totalProfit:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement