Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp8
- {
- class Program
- {
- static void Main(string[] args)
- {
- int km = int.Parse(Console.ReadLine());
- string dayOrNight = Console.ReadLine();
- double taxiPrice = 0.70;
- double bus = 0.09;
- double train = 0.06;
- if (km < 20 && km>0) // TAXI CHECK
- {
- if (dayOrNight == "day")
- {
- double tarifa = 0.79;
- double price = taxiPrice + km * tarifa;
- Console.WriteLine($"{price:f2}");
- }
- else if (dayOrNight == "night")
- {
- double tarifa = 0.90;
- double price = taxiPrice + km * tarifa;
- Console.WriteLine($"{price:f2}");
- }
- }
- else if (km >= 100)
- {
- if (dayOrNight == "day" || dayOrNight == "night")
- {
- double price = km * train;
- Console.WriteLine($"{price:f2}");
- }
- }if (km >= 20 && km <100)
- {
- if (dayOrNight == "day" || dayOrNight == "night")
- {
- double price = km * bus;
- Console.WriteLine($"{price:f2}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement