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 Transport_Price
- {
- class Program
- {
- static void Main(string[] args)
- {
- double TaxyStart = 0.7d;
- double TaxiDay = 0.79d;
- double TaxiNight = 0.9d;
- double Autobus = 0.09d;
- double Train = 0.06d;
- double PriceTaxi = 0.0d;
- double PriceBus = 0.0d;
- double PriceTrain = 0.0d;
- double Distance = double.Parse(Console.ReadLine());
- string daynight = Console.ReadLine();
- if (daynight == "day")
- {
- if (Distance < 20)
- {
- PriceTaxi = TaxyStart + TaxiDay * Distance;
- Console.WriteLine(PriceTaxi);
- }
- else if (Distance >= 20 && Distance < 100)
- {
- PriceTaxi = TaxyStart + TaxiDay * Distance;
- PriceBus = Autobus * Distance;
- double result = Math.Min(PriceTaxi, PriceBus);
- Console.WriteLine("{0:0.00}",result);
- }
- else if (Distance >= 100)
- {
- PriceTaxi = TaxyStart + TaxiDay * Distance;
- PriceBus = Autobus * Distance;
- PriceTrain = Train * Distance;
- double result = Math.Min(PriceTaxi, Math.Min(PriceBus, PriceTrain));
- Console.WriteLine("{0:0.00}", result);
- }
- }
- if (daynight == "night")
- {
- if (Distance < 20)
- {
- PriceTaxi = TaxyStart + TaxiNight * Distance;
- Console.WriteLine("{0:0.00}", PriceTaxi);
- }
- else if (Distance >= 20 && Distance < 100)
- {
- PriceTaxi = TaxyStart + TaxiNight * Distance;
- PriceBus = Autobus * Distance;
- double result = Math.Min(PriceTaxi, PriceBus);
- Console.WriteLine("{0:0.00}", result);
- }
- else if (Distance >= 100)
- {
- PriceTaxi = TaxyStart + TaxiNight * Distance;
- PriceBus = Autobus * Distance;
- PriceTrain = Train * Distance;
- double result = Math.Min(PriceTaxi, Math.Min(PriceBus, PriceTrain));
- Console.WriteLine("{0:0.00}", result);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment