Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ReservationOnFlying
- {
- class Program
- {
- static void Main(string[] args)
- {
- string classOnTicket = Console.ReadLine(); // класа на билета
- double lengthOnFlight = double.Parse(Console.ReadLine()); // дължина на полета
- int passagersCount = int.Parse(Console.ReadLine()); //брой пътници
- decimal priceOnTickets = 0m;
- decimal totalPrice = 0m;
- switch (classOnTicket)
- {
- case "Economy":
- if (lengthOnFlight < 1500)
- {
- priceOnTickets = 59.99m;
- }
- else if (lengthOnFlight >= 1500 && lengthOnFlight <= 3500)
- {
- priceOnTickets = 184.99m;
- }
- else if (lengthOnFlight > 3500)
- {
- priceOnTickets = 269.99m;
- }
- break;
- case "Premium":
- if (lengthOnFlight < 1500)
- {
- priceOnTickets = 179.99m;
- }
- else if (lengthOnFlight >= 1500 && lengthOnFlight <= 3500)
- {
- priceOnTickets = 279.99m;
- }
- else if (lengthOnFlight > 3500)
- {
- priceOnTickets = 394.99m;
- }
- break;
- case "Business":
- if (lengthOnFlight < 1500)
- {
- priceOnTickets = 254.99m;
- }
- else if (lengthOnFlight >= 1500 && lengthOnFlight <= 3500)
- {
- priceOnTickets = 379.99m;
- }
- else if (lengthOnFlight > 3500)
- {
- priceOnTickets = 619.99m;
- }
- break;
- }
- totalPrice = priceOnTickets * passagersCount;
- if (passagersCount > 6)
- totalPrice = totalPrice * 0.8m;
- Console.WriteLine($"The total price of the tickets is: {totalPrice :f2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement